Skip to content

Commit 0d66f2d

Browse files
Roi LipmanRoi Lipman
Roi Lipman
authored and
Roi Lipman
committed
updated readme
1 parent b142612 commit 0d66f2d

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

README.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,49 @@ $ go get github.com/redislabs/redisgraph-go
2222
package main
2323

2424
import (
25-
"github.com/gomodule/redigo/redis"
26-
rg "github.com/redislabs/redisgraph-go"
25+
"github.com/gomodule/redigo/redis"
26+
rg "github.com/redislabs/redisgraph-go"
2727
)
2828

2929
func main() {
30-
conn, _ := redis.Dial("tcp", "0.0.0.0:6379")
31-
defer conn.Close()
32-
33-
graph := rg.Graph{}.New("social", conn)
34-
35-
john := rg.Node{
36-
Label: "person",
37-
Properties: map[string]interface{}{
38-
"name": "John Doe",
39-
"age": 33,
40-
"gender": "male",
41-
"status": "single",
42-
},
43-
}
44-
graph.AddNode(&john)
45-
46-
japan := rg.Node{
47-
Label: "country",
48-
Properties: map[string]interface{}{
49-
"name": "Japan",
50-
},
51-
}
52-
graph.AddNode(&japan)
53-
54-
edge := rg.Edge{
55-
Source: &john,
56-
Relation: "visited",
57-
Destination: &japan,
58-
}
59-
graph.AddEdge(&edge)
60-
61-
graph.Commit()
62-
63-
query := `MATCH (p:person)-[v:visited]->(c:country)
64-
RETURN p.name, p.age, v.purpose, c.name`
65-
rs, _ := graph.Query(query)
66-
67-
rs.PrettyPrint()
30+
conn, _ := redis.Dial("tcp", "0.0.0.0:6379")
31+
defer conn.Close()
32+
33+
graph := rg.GraphNew("social", conn)
34+
35+
john := rg.Node{
36+
Label: "person",
37+
Properties: map[string]interface{}{
38+
"name": "John Doe",
39+
"age": 33,
40+
"gender": "male",
41+
"status": "single",
42+
},
43+
}
44+
graph.AddNode(&john)
45+
46+
japan := rg.Node{
47+
Label: "country",
48+
Properties: map[string]interface{}{
49+
"name": "Japan",
50+
},
51+
}
52+
graph.AddNode(&japan)
53+
54+
edge := rg.Edge{
55+
Source: &john,
56+
Relation: "visited",
57+
Destination: &japan,
58+
}
59+
graph.AddEdge(&edge)
60+
61+
graph.Commit()
62+
63+
query := `MATCH (p:person)-[v:visited]->(c:country)
64+
RETURN p.name, p.age, v.purpose, c.name`
65+
rs, _ := graph.Query(query)
66+
67+
rs.PrettyPrint()
6868
}
6969
```
7070

0 commit comments

Comments
 (0)