store

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDrainTimeout = 5 * time.Second

DefaultDrainTimeout is reserved for future writer-loop stores.

Variables

This section is empty.

Functions

func Checkpoint

func Checkpoint(ctx context.Context, db *sql.DB) error

Checkpoint truncates the WAL for an open SQLite database.

func CloseSQLiteDatabase

func CloseSQLiteDatabase(ctx context.Context, db *sql.DB) error

CloseSQLiteDatabase checkpoints the WAL before closing the database handle.

func EnsureSchema

func EnsureSchema(ctx context.Context, db *sql.DB, statements []string) error

EnsureSchema executes each schema statement in order.

func FormatTimestamp

func FormatTimestamp(value time.Time) string

FormatTimestamp renders a timestamp in the canonical SQLite text layout.

func IsSQLiteBusy

func IsSQLiteBusy(err error) bool

IsSQLiteBusy reports transient lock contention from SQLite.

func NewID

func NewID(prefix string) string

NewID returns a random identifier with an optional prefix.

func NullString

func NullString(value sql.NullString) *string

NullString converts sql.NullString into a trimmed string pointer.

func NullableString

func NullableString(value string) any

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

func ParseTimestamp(value string) (time.Time, error)

ParseTimestamp parses the canonical SQLite text timestamp.

func ShouldRecoverSQLite

func ShouldRecoverSQLite(err error) bool

ShouldRecoverSQLite reports whether the open error indicates recoverable corruption.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL