Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,32 @@ import (
)

func main() {
db, _ := falkordb.FalkorDBNew(&falkordb.ConnectionOption{Addr: "0.0.0.0:6379"})
db, err := falkordb.FalkorDBNew(&falkordb.ConnectionOption{Addr: "0.0.0.0:6379"})
if err != nil {
fmt.Println("Error connecting to the database:", err)
os.Exit(1)
}
Comment on lines +42 to +46

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Missing module version suffix in import path
The example code still imports github.com/falkordb/falkordb-go, but since your go.mod now declares …/v2, this should be updated to:

import (
    "fmt"
    "os"

    "github.com/FalkorDB/falkordb-go/v2"
)

Otherwise the snippet will fail to compile.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

42-42: Hard tabs
Column: 1

(MD010, no-hard-tabs)


43-43: Hard tabs
Column: 1

(MD010, no-hard-tabs)


44-44: Hard tabs
Column: 1

(MD010, no-hard-tabs)


45-45: Hard tabs
Column: 1

(MD010, no-hard-tabs)


46-46: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In README.md around lines 42 to 46, the import path for the FalkorDB module is
missing the required version suffix '/v2' as declared in go.mod. Update the
import statement to include the version suffix by changing the import path to
"github.com/FalkorDB/falkordb-go/v2" to ensure the example code compiles
correctly.


graph := db.SelectGraph("social")

graph.Query("CREATE (:Person {name: 'John Doe', age: 33, gender: 'male', status: 'single'})-[:VISITED]->(:VISITED {name: 'Japan'})", nil, nil)
_, err = graph.Query("CREATE (:Person {name: 'John Doe', age: 33, gender: 'male', status: 'single'})-[:VISITED]->(:VISITED {name: 'Japan'})", nil, nil)
if err != nil {
fmt.Println("Error executing CREATE query:", err)
os.Exit(1)
}

query, err := "MATCH (p:Person)-[v:VISITED]->(c:VISITED) RETURN p.name, p.age, c.name"
query := "MATCH (p:Person)-[v:VISITED]->(c:VISITED) RETURN p.name, p.age, c.name"
result, err := graph.Query(query, nil, nil)
if err != nil {
fmt.Println("Error executing MATCH query:", err)
os.Exit(1)
}

// result is a QueryResult struct containing the query's generated records and statistics.
result, _ := graph.Query(query, nil, nil)
// Check if result is nil
if result == nil {
fmt.Println("No result returned from the query.")
os.Exit(1)
}

// Pretty-print the full result set as a table.
result.PrettyPrint()
Expand All @@ -70,17 +83,18 @@ func main() {
}

// Path matching example.
query = "MATCH p = (:person)-[:visited]->(:country) RETURN p"
result, err := graph.Query(query, nil, nil)
query = "MATCH p = (:Person)-[:VISITED]->(:VISITED) RETURN p"
result, err = graph.Query(query, nil, nil)
if err != nil {
fmt.Println(err)
fmt.Println("Error executing MATCH path query:", err)
os.Exit(1)
}
fmt.Println("Pathes of persons visiting countries:")

fmt.Println("Paths of persons visiting countries:")
for result.Next() {
r := result.Record()
p, ok := r.GetByIndex(0).(rg.Path)
fmt.Printf("%s %v\n", p, ok)
p, ok := r.GetByIndex(0).(falkordb.Path)
fmt.Printf("%v %v\n", p, ok)
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/FalkorDB/falkordb-go
module github.com/FalkorDB/falkordb-go/v2

go 1.12

Expand Down