go-rel / go-rel/rel

Docs: Use a raw query?

Open
#383 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
786
Forks
61
Avg merge
4d 11h
Merged PRs (30d)
2

Description

I made my SurrealDB driver work and am currently testing it - and while testing the more "not so standart" parts of SurrealDB, I realized that... I had no idea how to run raw queries.

```go
func main() {
adapter, err := srel.Open("ws://root:root@127.0.0.1:8000/rpc?method=root")
if err != nil {
log.Fatal(err.Error())
}
defer adapter.Close()

repo := rel.New(adapter)
sql := rel.SQL("INFO FOR ROOT;")
cursor, err := adapter.Query(context.TODO(), rel.Query{
SQLQuery: sql,
})
if err != nil {
log.Fatal(err.Error())
}
fields, err := cursor.Fields()
if err != nil {
log.Fatal(err.Error())
}
fmt.Print(fields)
}
```

Is there an easier way to construct raw queries? I can't imagine it's this convoluted... x)

Kind regards,
Ingwie

Contributor guide

Open the contributing guide

Research direction

Start with the adapter.Query and rel.SQL usage shown in the issue, then inspect the project’s raw-query entry points and documentation. Done means the supported way to construct and execute a raw SurrealDB query is clarified, with a simpler example documented if one exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.