4
4
5
5
/*
6
6
7
- Package neo4j is a client library providing access to the Neo4j graph database
7
+ Package neoism is a client library providing access to the Neo4j graph database
8
8
via its REST API.
9
9
10
10
@@ -14,32 +14,32 @@ Example Usage:
14
14
15
15
import (
16
16
"fmt"
17
- "github.com/jmcvetta/neo4j "
17
+ "github.com/jmcvetta/neoism "
18
18
)
19
19
20
20
func main() {
21
21
// No error handling in this example - bad, bad, bad!
22
22
//
23
23
// Connect to the Neo4j server
24
24
//
25
- db, _ := neo4j .Connect("http://localhost:7474/db/data")
25
+ db, _ := neoism .Connect("http://localhost:7474/db/data")
26
26
kirk := "Captain Kirk"
27
27
mccoy := "Dr McCoy"
28
28
//
29
29
// Create a node
30
30
//
31
- n0, _ := db.CreateNode(neo4j .Props{"name": kirk})
31
+ n0, _ := db.CreateNode(neoism .Props{"name": kirk})
32
32
defer n0.Delete() // Deferred clean up
33
33
//
34
34
// Create a node with a Cypher query
35
35
//
36
36
res0 := []struct {
37
- N neo4j .Node // Column "n" gets automagically unmarshalled into field N
37
+ N neoism .Node // Column "n" gets automagically unmarshalled into field N
38
38
}{}
39
- cq0 := neo4j .CypherQuery{
39
+ cq0 := neoism .CypherQuery{
40
40
Statement: "CREATE (n:Person {name: {name}}) RETURN n",
41
41
// Use parameters instead of constructing a query string
42
- Parameters: neo4j .Props{"name": mccoy},
42
+ Parameters: neoism .Props{"name": mccoy},
43
43
Result: &res0,
44
44
}
45
45
db.Cypher(&cq0)
@@ -48,7 +48,7 @@ Example Usage:
48
48
//
49
49
// Create a relationship
50
50
//
51
- n1.Relate("reports to", n0.Id(), neo4j .Props{}) // Empty Props{} is okay
51
+ n1.Relate("reports to", n0.Id(), neoism .Props{}) // Empty Props{} is okay
52
52
//
53
53
// Issue a query
54
54
//
@@ -57,14 +57,14 @@ Example Usage:
57
57
Rel string `json:"type(r)"`
58
58
B string `json:"b.name"`
59
59
}{}
60
- cq1 := neo4j .CypherQuery{
60
+ cq1 := neoism .CypherQuery{
61
61
// Use backticks for long statements - Cypher is whitespace indifferent
62
62
Statement: `
63
63
MATCH (a:Person)-[r]->(b)
64
64
WHERE a.name = {name}
65
65
RETURN a.name, type(r), b.name
66
66
`,
67
- Parameters: neo4j .Props{"name": mccoy},
67
+ Parameters: neoism .Props{"name": mccoy},
68
68
Result: &res1,
69
69
}
70
70
db.Cypher(&cq1)
@@ -73,26 +73,26 @@ Example Usage:
73
73
//
74
74
// Clean up using a transaction
75
75
//
76
- qs := []*neo4j .CypherQuery{
77
- &neo4j .CypherQuery{
76
+ qs := []*neoism .CypherQuery{
77
+ &neoism .CypherQuery{
78
78
Statement: `
79
79
MATCH (n:Person)-[r]->()
80
80
WHERE n.name = {name}
81
81
DELETE r
82
82
`,
83
- Parameters: neo4j .Props{"name": mccoy},
83
+ Parameters: neoism .Props{"name": mccoy},
84
84
},
85
- &neo4j .CypherQuery{
85
+ &neoism .CypherQuery{
86
86
Statement: `
87
87
MATCH n:Person
88
88
WHERE n.name = {name}
89
89
DELETE n
90
90
`,
91
- Parameters: neo4j .Props{"name": mccoy},
91
+ Parameters: neoism .Props{"name": mccoy},
92
92
},
93
93
}
94
94
tx, _ := db.Begin(qs)
95
95
tx.Commit()
96
96
}
97
97
*/
98
- package neo4j
98
+ package neoism
0 commit comments