Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
sqlx
✓ github.com/jmoiron/sqlx
Connect to an in-memory SQLite database, create a table, insert and query a row
package main
import (
"fmt"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
)
func main() {
db, err := sqlx.Connect("sqlite3", ":memory:")
if err != nil {
panic(err)
}
defer db.Close()
db.MustExec("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT)")
db.MustExec("INSERT INTO test (name) VALUES (?)", "Alice")
var name string
err = db.Get(&name, "SELECT name FROM test WHERE id=1")
if err != nil {
panic(err)
}
fmt.Println(name)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
1.4.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.