INNER CODE UNIT · Go
createSampleData
orneryd/NornicDB · cmd/eval/main.go:559
func createSampleData(serverURL string) error {
// Construct full URL safely using url.JoinPath to prevent path traversal
targetURL, err := url.JoinPath(serverURL, "db", "nornic", "tx", "commit")
if err != nil {
return fmt.Errorf("failed to construct request URL: %w", err)
}
client := newSafeClient(30 * time.Second)
// Sample nodes to create
cypher := `
CREATE (n1:Memory:Concept {id: 'ml-intro', title: 'Introduction to Machine Learning', content: 'Machine learning is AI that learns from data'})
CREATE (n2:Memory:Concept {id: 'ml-neural', title: 'Neural Networks', content: 'Neural networks are inspired by biological brains'})
CREATE (n3:Memory:Decision {id: 'db-design', title: 'Database Decision', content: 'We chose PostgreSQL for relational and NornicDB for graphs'})
CREATE (n4:Memory:Code {id: 'code-auth', title: 'Auth Middleware', content: 'JWT authentication middleware for API'})
CREATE (n5:Task {id: 'task-api', title: 'REST API', content: 'Implement user management endpoints', status: 'pending'})
`