Documentation
¶
Index ¶
- Constants
- func Checkpoint(ctx context.Context, db *sql.DB) error
- func CloseSQLiteDatabase(ctx context.Context, db *sql.DB) error
- func EnsureSchema(ctx context.Context, db *sql.DB, statements []string) error
- func FormatTimestamp(value time.Time) string
- func IsSQLiteBusy(err error) bool
- func NewID(prefix string) string
- func NullString(value sql.NullString) *string
- func NullableString(value string) any
- func OpenSQLiteDatabase(ctx context.Context, path string, ...) (*sql.DB, error)
- func ParseTimestamp(value string) (time.Time, error)
- func ShouldRecoverSQLite(err error) bool
Constants ¶
const DefaultDrainTimeout = 5 * time.Second
DefaultDrainTimeout is reserved for future writer-loop stores.
Variables ¶
This section is empty.
Functions ¶
func Checkpoint ¶
Checkpoint truncates the WAL for an open SQLite database.
func CloseSQLiteDatabase ¶
CloseSQLiteDatabase checkpoints the WAL before closing the database handle.
func EnsureSchema ¶
EnsureSchema executes each schema statement in order.
func FormatTimestamp ¶
FormatTimestamp renders a timestamp in the canonical SQLite text layout.
func IsSQLiteBusy ¶
IsSQLiteBusy reports transient lock contention from SQLite.
func NullString ¶
func NullString(value sql.NullString) *string
NullString converts sql.NullString into a trimmed string pointer.
func NullableString ¶
NullableString maps blank strings to SQL NULL.
func OpenSQLiteDatabase ¶
func OpenSQLiteDatabase( ctx context.Context, path string, initialize func(context.Context, *sql.DB) error, ) (*sql.DB, error)
OpenSQLiteDatabase opens a SQLite database, applies shared configuration, and retries once after moving aside a corrupt file.
func ParseTimestamp ¶
ParseTimestamp parses the canonical SQLite text timestamp.
func ShouldRecoverSQLite ¶
ShouldRecoverSQLite reports whether the open error indicates recoverable corruption.
Types ¶
This section is empty.