Documentation ¶
Overview ¶
Package db defines database utility functions.
These functions currently work on a sqlite database. Other databases may not work with functions in this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Accessor ¶
An Accessor manages a sqlite database handle and any outstanding batching operations.
func MakeAccessor ¶
MakeAccessor creates a new Accessor.
func MakeErasableAccessor ¶
MakeErasableAccessor creates a new Accessor with the secure_delete pragma set; see https://www.sqlite.org/pragma.html#pragma_secure_delete It is not read-only and not in-memory (otherwise, erasability doesn't matter)
type Queryable ¶
type Queryable interface { Prepare(query string) (*sql.Stmt, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row }
Queryable is meant to represent the union of a transaction (sql.Tx) and the underlying database (sql.DB), so that code issuing a single read-only query can be run directly on the sql.DB object without creating a short-lived transaction for a single SELECT query.
Queryable captures only a subset of Go's SQL API for issuing reads; if new code needs additional methods to query a SQL DB, they should be added here as needed.