1
1
package main
2
2
3
3
import (
4
+ "graph-db/api"
5
+ "graph-db/internal/app/core/structs"
4
6
"graph-db/internal/app/core"
5
7
"graph-db/internal/pkg/utils"
6
8
"graph-db/internal/app/core/globals"
7
9
"log"
8
- "graph-db/api"
9
- "graph-db/internal/app/core/structs"
10
10
)
11
11
12
12
func printNode (node structs.Node ) {
13
13
var str string
14
14
str += "Node labels: "
15
15
for _ , label := range node .GetLabel ().GetLabelNames () {
16
- if label .GetTitle () != "" {
16
+ if label != nil && label .GetTitle () != "" {
17
17
str += label .GetTitle ()
18
18
str += ", "
19
19
}
20
20
}
21
21
str += "\n "
22
22
str += "Relationships: \n "
23
23
relationship := node .GetRelationship ()
24
- i := 1
25
- for true {
26
- if relationship != nil {
27
- str += "\n \t "
28
- str += string (i )
29
- str += "\t Title: "
30
- str += relationship .GetTitle ().GetTitle ()
31
- i ++
32
- }
24
+ if relationship != nil {
25
+ str += "\t Title: "
26
+ str += relationship .GetTitle ().GetTitle ()
33
27
}
28
+ println (str )
34
29
}
35
30
36
31
func main () {
37
32
//err := core.InitDb("asd", "local")
38
- //err = core.SwitchDb("asd")
33
+ //// err = core.SwitchDb("asd")
39
34
//utils.CheckError(err)
40
35
41
36
dbTitle := "asd"
@@ -52,11 +47,11 @@ func main() {
52
47
newBs := make ([]byte , 4 )
53
48
dfh .Read (globals .NodesStore , 20 , & newBs , 0 )
54
49
55
- // if string(newBs) != string(bs) {
56
- // log.Fatal("Byte arrays are not the same!")
57
- // } else {
58
- // println("Congratulations!")
59
- // }
50
+ if string (newBs ) != string (bs ) {
51
+ log .Fatal ("Byte arrays are not the same!" )
52
+ } else {
53
+ println ("Congratulations!" )
54
+ }
60
55
61
56
node1 := api .CreateNode ("Kevin" )
62
57
node2 := api .CreateNode ("Sergey" )
0 commit comments