周玉环 d906a41c2e first commit 2 zile în urmă
..
c d906a41c2e first commit 2 zile în urmă
sqlitex d906a41c2e first commit 2 zile în urmă
.gitignore d906a41c2e first commit 2 zile în urmă
.travis.yml d906a41c2e first commit 2 zile în urmă
LICENSE d906a41c2e first commit 2 zile în urmă
Makefile d906a41c2e first commit 2 zile în urmă
README.md d906a41c2e first commit 2 zile în urmă
appveyor.yml d906a41c2e first commit 2 zile în urmă
auth.go d906a41c2e first commit 2 zile în urmă
backup.go d906a41c2e first commit 2 zile în urmă
blob.go d906a41c2e first commit 2 zile în urmă
blocking_step.c d906a41c2e first commit 2 zile în urmă
blocking_step.h d906a41c2e first commit 2 zile în urmă
doc.go d906a41c2e first commit 2 zile în urmă
dummy.go d906a41c2e first commit 2 zile în urmă
error.go d906a41c2e first commit 2 zile în urmă
extension.go d906a41c2e first commit 2 zile în urmă
func.go d906a41c2e first commit 2 zile în urmă
incrementor.go d906a41c2e first commit 2 zile în urmă
link.go d906a41c2e first commit 2 zile în urmă
openflags.go d906a41c2e first commit 2 zile în urmă
session.go d906a41c2e first commit 2 zile în urmă
snapshot.go d906a41c2e first commit 2 zile în urmă
sqlite.go d906a41c2e first commit 2 zile în urmă
sqlite3.h d906a41c2e first commit 2 zile în urmă
sqlite3ext.h d906a41c2e first commit 2 zile în urmă
static.go d906a41c2e first commit 2 zile în urmă
wrappers.c d906a41c2e first commit 2 zile în urmă
wrappers.h d906a41c2e first commit 2 zile în urmă
zombiezen-compat.go d906a41c2e first commit 2 zile în urmă

README.md

Low-level Go interface to SQLite

Go Reference

This project is a community-managed fork of https://github.com/crawshaw/sqlite.

This package provides a low-level Go interface to SQLite 3. Connections are pooled and if the SQLite shared cache mode is enabled the package takes advantage of the unlock-notify API to minimize the amount of handling user code needs for dealing with database lock contention.

It has interfaces for some of SQLite's more interesting extensions, such as incremental BLOB I/O and the session extension.

A utility package, sqlitex, provides some higher-level tools for making it easier to perform common tasks with SQLite. In particular it provides support to make nested transactions easy to use via sqlitex.Save.

This is not a database/sql driver.


## Example

A HTTP handler that uses a multi-threaded pool of SQLite connections via a shared cache.

go var dbpool *sqlitex.Pool

func main() {

var err error
dbpool, err = sqlitex.Open("file:memory:?mode=memory", 0, 10)
if err != nil {
    log.Fatal(err)
}
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))

}

func handler(w http.ResponseWriter, r *http.Request) {

conn := dbpool.Get(r.Context())
if conn == nil {
    return
}
defer dbpool.Put(conn)
stmt := conn.Prep("SELECT foo FROM footable WHERE id = $id;")
stmt.SetText("$id", "_user_id_")
for {
    if hasRow, err := stmt.Step(); err != nil {
        // ... handle error
    } else if !hasRow {
        break
    }
    foo := stmt.GetText("foo")
    // ... use foo
}

} ```

https://pkg.go.dev/github.com/go-llsqlite/llsqlite

Platform specific considerations

By default it requires some pthreads DLL on Windows. To avoid it, supply CGO_LDFLAGS="-static" when building your application.