周玉环 d906a41c2e first commit 2 өдөр өмнө
..
fs d906a41c2e first commit 2 өдөр өмнө
sqlitex d906a41c2e first commit 2 өдөр өмнө
.envrc d906a41c2e first commit 2 өдөр өмнө
.gitignore d906a41c2e first commit 2 өдөр өмнө
CHANGELOG.md d906a41c2e first commit 2 өдөр өмнө
CODE_OF_CONDUCT.md d906a41c2e first commit 2 өдөр өмнө
CONTRIBUTING.md d906a41c2e first commit 2 өдөр өмнө
LICENSE d906a41c2e first commit 2 өдөр өмнө
README.md d906a41c2e first commit 2 өдөр өмнө
auth.go d906a41c2e first commit 2 өдөр өмнө
backup.go d906a41c2e first commit 2 өдөр өмнө
blob.go d906a41c2e first commit 2 өдөр өмнө
blocking_step.go d906a41c2e first commit 2 өдөр өмнө
doc.go d906a41c2e first commit 2 өдөр өмнө
func.go d906a41c2e first commit 2 өдөр өмнө
go.work d906a41c2e first commit 2 өдөр өмнө
go.work.sum d906a41c2e first commit 2 өдөр өмнө
index_constraint.go d906a41c2e first commit 2 өдөр өмнө
op_type.go d906a41c2e first commit 2 өдөр өмнө
openflags.go d906a41c2e first commit 2 өдөр өмнө
result.go d906a41c2e first commit 2 өдөр өмнө
session.go d906a41c2e first commit 2 өдөр өмнө
shell.nix d906a41c2e first commit 2 өдөр өмнө
sqlite.go d906a41c2e first commit 2 өдөр өмнө
vtable.go d906a41c2e first commit 2 өдөр өмнө

README.md

zombiezen.com/go/sqlite

Go Reference

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

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

ISC