impldb

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(h *Handle) error

func NullInt64

func NullInt64(v int64) sql.NullInt64

NullInt64 returns a valid sql.NullInt64 if v > 0, otherwise null.

func NullStr

func NullStr(s string) sql.NullString

NullStr returns a valid sql.NullString if s is non-empty, otherwise null.

func RollbackTx

func RollbackTx(tx *sql.Tx)

Types

type Handle

type Handle struct {
	DB      *sql.DB
	Queries *impldbgen.Queries
}

func Open

func Open(ctx context.Context, dbPath string, opts OpenOptions) (*Handle, error)

func OpenNoMigrate

func OpenNoMigrate(ctx context.Context, dbPath string, opts OpenOptions) (*Handle, error)

OpenNoMigrate opens the database without running migrations. Use this on hot paths (e.g., broker observation emission) where the database is expected to already exist and be at the current schema version. Returns an error if the database file does not exist.

type OpenOptions

type OpenOptions struct {
	BusyTimeout time.Duration
	Synchronous string
	TxImmediate bool // if true, all BEGIN statements use IMMEDIATE locking
}

func DefaultOpenOptions

func DefaultOpenOptions() OpenOptions

DefaultOpenOptions returns the standard options used by most callers: BusyTimeout 250ms, Synchronous "NORMAL".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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