Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Roi Lipman authored and Roi Lipman committed Jun 2, 2019
1 parent b142612 commit 0d66f2d
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,49 @@ $ go get github.com/redislabs/redisgraph-go
package main

import (
"github.com/gomodule/redigo/redis"
rg "github.com/redislabs/redisgraph-go"
"github.com/gomodule/redigo/redis"
rg "github.com/redislabs/redisgraph-go"
)

func main() {
conn, _ := redis.Dial("tcp", "0.0.0.0:6379")
defer conn.Close()

graph := rg.Graph{}.New("social", conn)

john := rg.Node{
Label: "person",
Properties: map[string]interface{}{
"name": "John Doe",
"age": 33,
"gender": "male",
"status": "single",
},
}
graph.AddNode(&john)

japan := rg.Node{
Label: "country",
Properties: map[string]interface{}{
"name": "Japan",
},
}
graph.AddNode(&japan)

edge := rg.Edge{
Source: &john,
Relation: "visited",
Destination: &japan,
}
graph.AddEdge(&edge)

graph.Commit()

query := `MATCH (p:person)-[v:visited]->(c:country)
RETURN p.name, p.age, v.purpose, c.name`
rs, _ := graph.Query(query)

rs.PrettyPrint()
conn, _ := redis.Dial("tcp", "0.0.0.0:6379")
defer conn.Close()

graph := rg.GraphNew("social", conn)

john := rg.Node{
Label: "person",
Properties: map[string]interface{}{
"name": "John Doe",
"age": 33,
"gender": "male",
"status": "single",
},
}
graph.AddNode(&john)

japan := rg.Node{
Label: "country",
Properties: map[string]interface{}{
"name": "Japan",
},
}
graph.AddNode(&japan)

edge := rg.Edge{
Source: &john,
Relation: "visited",
Destination: &japan,
}
graph.AddEdge(&edge)

graph.Commit()

query := `MATCH (p:person)-[v:visited]->(c:country)
RETURN p.name, p.age, v.purpose, c.name`
rs, _ := graph.Query(query)

rs.PrettyPrint()
}
```

Expand Down

0 comments on commit 0d66f2d

Please sign in to comment.