Documentation
¶
Overview ¶
Package store owns the SQLite database: opening it with the pragmas a long-running server needs, schema migrations, transactions and the key-value settings table. Every other package runs its own queries through a *DB; none opens the file itself.
Index ¶
- Variables
- type DB
- func (db *DB) Backup(ctx context.Context, path string) error
- func (db *DB) Close() error
- func (db *DB) DeleteSetting(ctx context.Context, key string) error
- func (db *DB) SetSetting(ctx context.Context, key, value string) error
- func (db *DB) Setting(ctx context.Context, key, def string) (string, error)
- func (db *DB) Settings(ctx context.Context, prefix string) (map[string]string, error)
- func (db *DB) Tx(ctx context.Context, fn func(*sql.Tx) error) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a looked-up row does not exist.
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB is the database, split into one writer connection and a small pool of readers. SQLite allows one writer at a time anyway; giving it a dedicated connection keeps writes from queueing behind busy timeouts, while WAL lets readers proceed concurrently.
func (*DB) DeleteSetting ¶
DeleteSetting removes one settings value.
func (*DB) SetSetting ¶
SetSetting writes one settings value.
Click to show internal directories.
Click to hide internal directories.