Documentation ¶
Overview ¶
Package db exposes a lightweight abstraction over the SQLite code. It performs some basic mapping of lower-level types to rqlite types.
Index ¶
- Variables
- type DB
- func (db *DB) Backup(path string) error
- func (db *DB) Close() error
- func (db *DB) EnableFKConstraints(e bool) error
- func (db *DB) Execute(queries []string, tx, xTime bool) ([]*Result, error)
- func (db *DB) FKConstraints() (bool, error)
- func (db *DB) Query(queries []string, tx, xTime bool) ([]*Rows, error)
- type Result
- type Rows
Constants ¶
This section is empty.
Variables ¶
var DBVersion string
DBVersion is the SQLite version.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is the SQL database.
func LoadInMemoryWithDSN ¶
LoadInMemoryWithDSN loads an in-memory database with that at the path, with the specified DSN
func OpenInMemoryWithDSN ¶
OpenInMemoryWithDSN opens an in-memory database with a specific DSN.
func OpenWithDSN ¶
OpenWithDSN opens a file-based database, creating it if it does not exist.
func (*DB) EnableFKConstraints ¶
EnableFKConstraints allows control of foreign key constraint checks.
func (*DB) FKConstraints ¶
FKConstraints returns whether FK constraints are set or not.
type Result ¶
type Result struct { LastInsertID int64 `json:"last_insert_id,omitempty"` RowsAffected int64 `json:"rows_affected,omitempty"` Error string `json:"error,omitempty"` Time float64 `json:"time,omitempty"` }
Result represents the outcome of an operation that changes rows.
type Rows ¶
type Rows struct { Columns []string `json:"columns,omitempty"` Types []string `json:"types,omitempty"` Values [][]interface{} `json:"values,omitempty"` Error string `json:"error,omitempty"` Time float64 `json:"time,omitempty"` }
Rows represents the outcome of an operation that returns query data.