MCPcopy Index your code
hub / github.com/glebarez/go-sqlite

github.com/glebarez/go-sqlite @v1.22.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.22.0 ↗ · + Follow
230 symbols 966 edges 18 files 121 documented · 53% 60 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Tests badge

go-sqlite

This is a pure-Go SQLite driver for Golang's native database/sql package. The driver has Go-based implementation of SQLite embedded in itself (so, you don't need to install SQLite separately)

Usage

Example

package main

import (
    "database/sql"
    "log"

    _ "github.com/glebarez/go-sqlite"
)

func main() {
    // connect
    db, err := sql.Open("sqlite", ":memory:")
    if err != nil {
        log.Fatal(err)
    }

    // get SQLite version
    _ := db.QueryRow("select sqlite_version()")
}

Connection string examples

  • in-memory SQLite: ":memory:"
  • on-disk SQLite: "path/to/some.db"
  • Foreign-key constraint activation: ":memory:?_pragma=foreign_keys(1)"

Settings PRAGMAs in connection string

Any SQLIte pragma can be preset for a Database connection using _pragma query parameter. Examples: - journal mode: path/to/some.db?_pragma=journal_mode(WAL) - busy timeout: :memory:?_pragma=busy_timeout(5000)

Multiple PRAGMAs can be specified, e.g.:

path/to/some.db?_pragma=busy_timeout(5000)&_pragma=journal_mode(WAL)

Core symbols most depended-on inside this repo

Exec
called by 87
sqlite.go
Close
called by 84
sqlite.go
Open
called by 48
sqlite.go
Query
called by 22
sqlite.go
errstr
called by 19
sqlite.go
Prepare
called by 19
sqlite.go
Next
called by 17
sqlite.go
Error
called by 15
sqlite.go

Shape

Function 131
Method 85
Struct 14

Languages

Go100%

Modules by API surface

sqlite.go94 symbols
all_test.go83 symbols
benchmark/bench.go14 symbols
benchmark/util.go13 symbols
sqlite_go18.go7 symbols
mutex.go3 symbols
functest/func_test.go2 symbols
examples/example1/main.go2 symbols
benchmark/bench_test.go2 symbols
addport.go2 symbols
sqlite_version_test.go1 symbols
sqlite_go18_test.go1 symbols

For agents

$ claude mcp add go-sqlite \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact