|
|
2 日 前 | |
|---|---|---|
| .. | ||
| fs | 2 日 前 | |
| sqlitex | 2 日 前 | |
| .envrc | 2 日 前 | |
| .gitignore | 2 日 前 | |
| CHANGELOG.md | 2 日 前 | |
| CODE_OF_CONDUCT.md | 2 日 前 | |
| CONTRIBUTING.md | 2 日 前 | |
| LICENSE | 2 日 前 | |
| README.md | 2 日 前 | |
| auth.go | 2 日 前 | |
| backup.go | 2 日 前 | |
| blob.go | 2 日 前 | |
| blocking_step.go | 2 日 前 | |
| doc.go | 2 日 前 | |
| func.go | 2 日 前 | |
| go.work | 2 日 前 | |
| go.work.sum | 2 日 前 | |
| index_constraint.go | 2 日 前 | |
| op_type.go | 2 日 前 | |
| openflags.go | 2 日 前 | |
| result.go | 2 日 前 | |
| session.go | 2 日 前 | |
| shell.nix | 2 日 前 | |
| sqlite.go | 2 日 前 | |
| vtable.go | 2 日 前 | |
zombiezen.com/go/sqliteThis package provides a low-level Go interface to SQLite 3.
It is a fork of crawshaw.io/sqlite that uses modernc.org/sqlite,
a CGo-free SQLite package.
It aims to be a mostly drop-in replacement for crawshaw.io/sqlite.
This package deliberately does not provide a database/sql driver.
See David Crawshaw's rationale for an in-depth explanation.
If you want to use database/sql with SQLite without CGo,
use modernc.org/sqlite directly.
modernc.org/sqlite,
an automatically generated translation of the original C source code of SQLite into GoCGO_ENABLED=0,
allowing cross-compiling and data race detectiongo fix-like tool for migrating existing code using
crawshaw.io/sqlitego get zombiezen.com/go/sqlite
While this library does not use CGo, make sure that you are building for one of the supported architectures.
import (
"fmt"
"zombiezen.com/go/sqlite"
"zombiezen.com/go/sqlite/sqlitex"
)
// ...
// Open an in-memory database.
conn, err := sqlite.OpenConn(":memory:", sqlite.OpenReadWrite)
if err != nil {
return err
}
defer conn.Close()
// Execute a query.
err = sqlitex.ExecuteTransient(conn, "SELECT 'hello, world';", &sqlitex.ExecOptions{
ResultFunc: func(stmt *sqlite.Stmt) error {
fmt.Println(stmt.ColumnText(0))
return nil
},
})
if err != nil {
return err
}
If you're creating a new application, see the package examples or the reference docs.
If you're looking to switch existing code that uses crawshaw.io/sqlite,
take a look at the migration docs.