Documentation
¶
Overview ¶
Package db opens the pipeline-analytics SQLite database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrDirMissing = errors.New("does not exist") ErrNotDirectory = errors.New("is not a directory") )
ErrDirMissing and ErrNotDirectory are what CheckDir wraps for a database path whose directory can't be used, so callers and tests match on the kind of fault with errors.Is rather than on message text.
Functions ¶
func CheckDir ¶ added in v0.57.0
CheckDir reports whether a SQLite database at path can be created or opened: its directory has to exist and be writable by this process, since SQLite writes a journal beside the file. Without it, a data directory owned by another user fails at startup as "unable to open database file (14)", which names neither the directory nor the cause. An in-memory database has no directory to check.
func Open ¶
Open opens the SQLite database at path (or ":memory:") with the pragmas pipeline-analytics needs: foreign keys enforced, and a busy timeout so concurrent writers back off instead of failing immediately.
The pool is capped at a single connection: SQLite serializes writers regardless, and a ":memory:" DSN backs a separate, empty database per connection under database/sql's pool -- a second pooled connection would silently see none of the first connection's tables or data.
Types ¶
This section is empty.