/
View dependency graph
Depends on
- dh-golang (dh-sequence-golang)
- golang-defaults (golang-any)
- golang-github-chzyer-readline (golang-github-chzyer-readline-dev)
- golang-github-crawshaw-iox (golang-github-crawshaw-iox-dev)
- golang-github-google-go-cmp (golang-github-google-go-cmp-dev)
- golang-golang-x-tools (golang-golang-x-tools-dev)
- golang-modernc-libc (golang-modernc-libc-dev)
- golang-modernc-sqlite (golang-modernc-sqlite-dev)
- debhelper-compat
README (full)
zombiezen.com/go/sqlite
This 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.
Features
- Full SQLite functionality via
modernc.org/sqlite, an automatically generated translation of the original C source code of SQLite into Go - Builds with
CGO_ENABLED=0, allowing cross-compiling and data race detection - Allows access to SQLite-specific features like blob I/O and user-defined functions
- Includes a simple schema migration package
- Utilities for running embedded SQL scripts using the Go 1.16 embedding feature
- A
go fix-like tool for migrating existing code usingcrawshaw.io/sqlite - A simple REPL for debugging
Install
go get zombiezen.com/go/sqlite
While this library does not use CGo, make sure that you are building for one of the supported architectures.
Getting Started
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.
License
| dir | .github/ |
| dir | .vscode/ |
| dir | cmd/ |
| dir | debian/ |
| dir | ext/ |
| dir | shell/ |
| dir | sqlitefile/ |
| dir | sqlitemigration/ |
| dir | sqlitex/ |
| file | .envrc |
| file | .gitignore |
| file | CHANGELOG.md |
| file | CODE_OF_CONDUCT.md |
| file | CONTRIBUTING.md |
| file | LICENSE |
| file | README.md |
| file | auth.go |
| file | auth_test.go |
| file | backup.go |
| file | backup_example_test.go |
| file | backup_test.go |
| file | blob.go |
| file | blob_test.go |
| file | blocking_step.go |
| file | doc.go |
| file | example_test.go |
| file | export_test.go |
| file | flake.lock |
| file | flake.nix |
| file | func.go |
| file | func_test.go |
| file | go.mod |
| file | go.sum |
| file | go.work |
| file | go.work.sum |
| file | http_example_test.go |
| file | index_constraint.go |
| file | internal_test.go |
| file | op_type.go |
| file | openflags.go |
| file | result.go |
| file | result_test.go |
| file | session.go |
| file | session_test.go |
| file | sqlite.go |
| file | sqlite_test.go |
| file | vtable.go |
| file | vtable_example_test.go |