Skip to content

Commit

Permalink
fix #1 rename to falkordb
Browse files Browse the repository at this point in the history
  • Loading branch information
gkorland committed Mar 30, 2024
1 parent 3b0ad09 commit 962a41d
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redisgraph
package falkordb

import (
"os"
Expand Down Expand Up @@ -437,7 +437,7 @@ func TestMultiLabelNode(t *testing.T) {
assert.Nil(t, err)

// create a multi label node
multiLabelNode := NodeNew([]string{"A","B"}, "n", nil)
multiLabelNode := NodeNew([]string{"A", "B"}, "n", nil)
graph.AddNode(multiLabelNode)
_, err = graph.Commit()
assert.Nil(t, err)
Expand Down
2 changes: 1 addition & 1 deletion edge.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redisgraph
package falkordb

import (
"fmt"
Expand Down
20 changes: 10 additions & 10 deletions example_graph_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redisgraph_test
package falkordb_test

import (
"crypto/tls"
Expand All @@ -8,21 +8,21 @@ import (
"log"
"os"

"github.com/RedisGraph/redisgraph-go"
"github.com/FalkorDB/falkordb-go"
"github.com/gomodule/redigo/redis"
)

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

graph := redisgraph.GraphNew("social", conn)
graph := falkordb.GraphNew("social", conn)

q := "CREATE (w:WorkPlace {name:'RedisLabs'}) RETURN w"
res, _ := graph.Query(q)

res.Next()
r := res.Record()
w := r.GetByIndex(0).(*redisgraph.Node)
w := r.GetByIndex(0).(*falkordb.Node)
fmt.Println(w.Labels[0])
// Output: WorkPlace
}
Expand All @@ -33,14 +33,14 @@ func ExampleGraphNew_pool() {
return redis.Dial("tcp", host)
}}

graph := redisgraph.GraphNew("social", pool.Get())
graph := falkordb.GraphNew("social", pool.Get())

q := "CREATE (w:WorkPlace {name:'RedisLabs'}) RETURN w"
res, _ := graph.Query(q)

res.Next()
r := res.Record()
w := r.GetByIndex(0).(*redisgraph.Node)
w := r.GetByIndex(0).(*falkordb.Node)
fmt.Println(w.Labels[0])
// Output: WorkPlace

Expand Down Expand Up @@ -96,25 +96,25 @@ func ExampleGraphNew_tls() {
)
}}

graph := redisgraph.GraphNew("social", pool.Get())
graph := falkordb.GraphNew("social", pool.Get())

q := "CREATE (w:WorkPlace {name:'RedisLabs'}) RETURN w"
res, _ := graph.Query(q)

res.Next()
r := res.Record()
w := r.GetByIndex(0).(*redisgraph.Node)
w := r.GetByIndex(0).(*falkordb.Node)
fmt.Println(w.Labels[0])
}

func getConnectionDetails() (host string, password string) {
value, exists := os.LookupEnv("REDISGRAPH_TEST_HOST")
value, exists := os.LookupEnv("FALKORDB_TEST_HOST")
host = "localhost:6379"
if exists && value != "" {
host = value
}
password = ""
valuePassword, existsPassword := os.LookupEnv("REDISGRAPH_TEST_PASSWORD")
valuePassword, existsPassword := os.LookupEnv("FALKORDB_TEST_PASSWORD")
if existsPassword && valuePassword != "" {
password = valuePassword
}
Expand Down
2 changes: 1 addition & 1 deletion graph.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redisgraph
package falkordb

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion node.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redisgraph
package falkordb

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion path.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redisgraph
package falkordb

import (
"fmt"
Expand Down
14 changes: 7 additions & 7 deletions query_result.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redisgraph
package falkordb

import (
"fmt"
Expand Down Expand Up @@ -55,11 +55,11 @@ type QueryResultHeader struct {

// QueryResult represents the results of a query.
type QueryResult struct {
graph *Graph
header QueryResultHeader
results []*Record
statistics map[string]float64
currentRecordIdx int
graph *Graph
header QueryResultHeader
results []*Record
statistics map[string]float64
currentRecordIdx int
}

func QueryResultNew(g *Graph, response interface{}) (*QueryResult, error) {
Expand All @@ -70,7 +70,7 @@ func QueryResultNew(g *Graph, response interface{}) (*QueryResult, error) {
column_names: make([]string, 0),
column_types: make([]ResultSetColumnTypes, 0),
},
graph: g,
graph: g,
currentRecordIdx: -1,
}

Expand Down
2 changes: 1 addition & 1 deletion record.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package redisgraph
package falkordb

type Record struct {
values []interface{}
Expand Down
10 changes: 5 additions & 5 deletions utils.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package redisgraph
package falkordb

import (
"crypto/rand"
"fmt"
"strings"
"strconv"
"strings"
)

// go array to string is [1 2 3] for [1, 2, 3] array
Expand Down Expand Up @@ -32,13 +32,13 @@ func strArrayToString(arr []string) string {
func mapToString(data map[string]interface{}) string {
pairsArray := []string{}
for k, v := range data {
pairsArray = append(pairsArray, k + ": " + ToString(v))
pairsArray = append(pairsArray, k+": "+ToString(v))
}
return "{" + strings.Join(pairsArray, ",") + "}"
}

func ToString(i interface{}) string {
if(i == nil) {
if i == nil {
return "null"
}

Expand Down Expand Up @@ -91,7 +91,7 @@ func RandomString(n int) string {
return string(output)
}

func BuildParamsHeader(params map[string]interface{}) (string) {
func BuildParamsHeader(params map[string]interface{}) string {
header := "CYPHER "
for key, value := range params {
header += fmt.Sprintf("%s=%v ", key, ToString(value))
Expand Down

0 comments on commit 962a41d

Please sign in to comment.