We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
github.com/chaisql/chai v0.16.0
package main
// import chai as a blank import import ( "database/sql" "log"
"github.com/chaisql/chai/driver"
)
type User struct { Id int Name string Age int }
func main() {
// Create a sql/database DB instance db, err := sql.Open("chai", "mydb") if err != nil { log.Fatal(err) } defer db.Close() if _, err = db.Exec(`
CREATE TABLE user ( id int, name TEXT , age int ) `); err != nil { log.Println("exec.create :", err) }
if _, err = db.Exec(`INSERT INTO user (id, name, age) VALUES (?, ?, ?)`, 20, "foo", 40); err != nil { log.Println("exec.INSERT :", err) } if row := db.QueryRow("SELECT id, name, age, address FROM user WHERE age >= ?", 18); row != nil { var u User if err = row.Scan(driver.Scanner(&u)); err == nil { log.Println("u:", u) } else { log.Println("Scan:", err) } }
}
read out data in db into user
2024/03/13 20:25:03 Scan: unsupported type reflect.Value. parameter is not a valid reference
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What version of Chai are you using?
What did you do?
package main
// import chai as a blank import
import (
"database/sql"
"log"
)
type User struct {
Id int
Name string
Age int
}
func main() {
CREATE TABLE user (
id int,
name TEXT ,
age int
)
`); err != nil {
log.Println("exec.create :", err)
}
}
What did you expect to see?
read out data in db into user
What did you see instead?
2024/03/13 20:25:03 Scan: unsupported type reflect.Value. parameter is not a valid reference
The text was updated successfully, but these errors were encountered: