go-sqlite

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2026 License: BSD-2-Clause

README

A small wrapper for [zombiezen/go-sqlite].

It just simplifies establishing a connection pool to a database and initializing flags and pragmas.

Most of the time, the following is sufficient to get going:

package main

import "git.sr.ht/~mikattack/go-sqlite/database"

func main() {
  // Default configuration, passed here for completeness.
  // May be omitted if you don't need other options.
  opts := Configuration{
    Flags:          0,
    MaxConnections: 10,
    Pragmas:        map[string]string = map[string]string{
      "busy_timeout": "5000",
      "foreign_keys": "on",
      "journal_mode": "wal",
    },
  }

  // Establish a *sqlitex.Pool with opts applied.
  pool, err := database.NewConnectionPool("file:/path/to/sqlite.db", opts)
  if err != nil {
    return nil, err
  }

  // Rest of application
  ...
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL