/
neo_test.go
103 lines (97 loc) · 2.27 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package neo_test
import (
"testing"
"github.com/krhancoc/frud/config"
"github.com/krhancoc/frud/database/neo"
)
var req = &config.DBRequest{
Method: "post",
Type: "meeting",
Model: []*config.Field{
&config.Field{
Key: "attending",
ValueType: "person",
ForeignKey: "name",
},
&config.Field{
Key: "nextup",
ValueType: "meeting",
ForeignKey: "date",
},
&config.Field{
Key: "another",
ValueType: "string",
Options: []string{"id"},
},
&config.Field{
Key: "here",
ValueType: "string",
},
},
Params: map[string]interface{}{
"attending": "ken",
"nextup": "datehere",
"another": "anotherthing",
"here": "HEY HELLO",
},
Queries: map[string]interface{}{
"attending": "ken",
"nextup": "datehere",
"another": "anotherthing",
},
}
var reqTwo = &config.DBRequest{
Method: "post",
Type: "meeting",
Model: []*config.Field{
&config.Field{
Key: "another",
ValueType: "string",
Options: []string{"id"},
},
},
Params: map[string]interface{}{
"another": "anotherthing",
},
}
var reqThree = &config.DBRequest{
Method: "post",
Type: "meeting",
Model: config.Fields{
&config.Field{
Key: "another",
ValueType: config.Fields{
&config.Field{
Key: "hello",
ValueType: "person",
ForeignKey: "name",
},
&config.Field{
Key: "world",
ValueType: "string",
},
},
Options: []string{"id"},
},
},
Params: map[string]interface{}{
"another": map[string]interface{}{
"hello": "bob",
"world": "yeppers",
},
},
}
func TestCypher(t *testing.T) {
cypher := neo.CreateCypher(req)
cypherTwo := neo.CreateCypher(reqTwo)
cypherThree := neo.CreateCypher(reqThree)
println(cypher.Match().ForeignKeys().Match().ForeignKeys().String())
println(cypher.Match().ForeignKeys().Create().Params().Relations().String())
println(cypherTwo.Create().Params().String())
println(cypherTwo.Match().ForeignKeys().Create().Params().Relations().String())
println(cypherTwo.Match().Params().Delete().String())
println(cypherTwo.Match().Queries().Return().String())
println(cypher.Match().Params().String())
println(cypher.MatchID().Set().String())
println(cypherThree.Match().ForeignKeys().Create().Params().Relations().String())
}