This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathneo_test.go
75 lines (73 loc) · 1.8 KB
/
neo_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package go_cypherdsl
type TestSerialize struct {
Name string `json:"name"`
Age int `json:"age"`
}
////this is purely to demonstrate usage
//func TestNeo(t *testing.T){
// //comment out to actually run
// if !testing.Short(){
// t.SkipNow()
// return
// }
//
// req := require.New(t)
//
// err := Init(&ConnectionConfig{
// Username: "neo4j",
// Password: "password",
// Host: "mindstand.com",
// Port: 7687,
// PoolSize: 15,
// })
//
// sess := NewSession()
// defer sess.Close()
// //err = sess.Begin()
// //req.Nil(err)
// //
// //ericParams, err := ParamsFromMap(map[string]interface{}{
// // "name": "Eric",
// // "age": 21,
// //})
// //req.Nil(err)
// //
// //nikitaParams, err := ParamsFromMap(map[string]interface{}{
// // "name": "Nikita",
// // "age": 21,
// //})
// //req.Nil(err)
// //
// //path := Path().P().V(V{Type:"TEST", Params:ericParams}).E(E{Types: []string{"CONN"}, Direction:DirectionPtr(DirectionOutgoing)}).V(V{Type: "TEST", Params: nikitaParams}).Build()
// //
// //res, err := sess.Query().Create(NewNode(path)).Return(ReturnPart{Name:"p"}).Exec(nil)
// //req.Nil(err)
// //req.NotNil(res)
// //
// //err = sess.Commit()
// //req.Nil(err)
// //
// //t.Log(res.RowsAffected())
// //t.Log(res.LastInsertId())
// //t.Log(res.Metadata())
//
// rows, err := sess.QueryReadOnly().
// Match(Path().V(V{Name: "n", Type:"OrganizationNode"}).Build()).
// With(&WithConfig{
// Parts: []WithPart{
// {Name: "n"},
// },
// }).
// Match(Path().P().V(V{Name: "n"}).E(E{Name: "e", MaxJumps:2}).V(V{Name: "c"}).Build()).Return(true, ReturnPart{Name: "p"}).Query(nil)
// req.Nil(err)
//
// arr, meta, err := rows.All()
// req.Nil(err)
//
// t.Log(arr)
// t.Log(meta)
//
// //notes, we will cast the first output from rows.all to graph.Path then use the ogm to convert that to structs
//
// t.Log("done")
//}