Trying to test the example mentioned here and wrote the below:
package main
import (
"log"
"github.com/codenotary/immudb/embedded/sql"
"github.com/codenotary/immudb/embedded/store"
)
func main() {
catalogStore, err := store.Open("catalog", store.DefaultOptions())
if err != nil {
log.Fatal(err)
}
dataStore, err := store.Open("sqldata", store.DefaultOptions())
if err != nil {
log.Fatal(err)
}
engine, err := sql.NewEngine(catalogStore, dataStore, []byte("sql"))
if err != nil {
log.Fatal(err)
}
_, err = engine.ExecStmt("CREATE DATABASE db1")
if err != nil {
log.Fatal(err)
}
_, err = engine.ExecStmt("USE DATABASE db1")
if err != nil {
log.Fatal(err)
}
_, err = engine.ExecStmt("CREATE TABLE journal (id INTEGER, date VARCHAR, creditaccount INTEGER, debitaccount INTEGER amount INTEGER, description VARCHAR, PRIMARY KEY id)")
if err != nil {
log.Fatal(err)
}
r, err := engine.QueryStmt("SELECT id, date, creditaccount, debitaccount, amount, description FROM journal WHERE amount > @value", map[string]interface{}{"value": 100}, true)
for {
row, err := r.Read()
if err == sql.ErrNoMoreRows {
break
}
if err != nil {
log.Fatal(err)
}
// do something with row.Values
}
}
But I'm getting errors at: engine.ExecStmt undefined (type *sql.Engine has no field or method ExecStmt)compiler[MissingFieldOrMethod](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source%3Dgopls#MissingFieldOrMethod) and too many arguments in call to sql.NewEngine have (*store.ImmuStore, *store.ImmuStore, []byte) want (*store.ImmuStore, *sql.Options)compiler[WrongArgCount](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source%3Dgopls#WrongArgCount)
Trying to test the example mentioned here and wrote the below:
But I'm getting errors at:
engine.ExecStmt undefined (type *sql.Engine has no field or method ExecStmt)compiler[MissingFieldOrMethod](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source%3Dgopls#MissingFieldOrMethod)
andtoo many arguments in call to sql.NewEngine have (*store.ImmuStore, *store.ImmuStore, []byte) want (*store.ImmuStore, *sql.Options)compiler[WrongArgCount](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source%3Dgopls#WrongArgCount)