sqlitedb

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackfillIntentTxid added in v0.9.0

func BackfillIntentTxid(ctx context.Context, dbh *sql.DB) error

func NewAssetRepository added in v0.9.0

func NewAssetRepository(config ...interface{}) (domain.AssetRepository, error)

func NewConvictionRepository added in v0.8.0

func NewConvictionRepository(config ...interface{}) (domain.ConvictionRepository, error)

func NewOffchainTxRepository

func NewOffchainTxRepository(config ...interface{}) (domain.OffchainTxRepository, error)

func NewRoundRepository

func NewRoundRepository(config ...interface{}) (domain.RoundRepository, error)

func NewSettingsRepository added in v0.9.9

func NewSettingsRepository(config ...interface{}) (domain.SettingsRepository, error)

func NewVtxoRepository

func NewVtxoRepository(config ...interface{}) (domain.VtxoRepository, error)

func SeedSettings added in v0.9.9

func SeedSettings(ctx context.Context, db *sql.DB, defaults domain.Settings) (err error)

SeedSettings seeds the singleton settings row from the config-built defaults on first boot, carrying over any legacy intent_fees / scheduled_session rows, then deletes those legacy rows. It runs at most once: after the settings row exists it returns immediately without touching anything (so it never clobbers admin changes).

Everything runs in one raw transaction so a crash rolls back cleanly, leaving the legacy data intact for the next boot. The write goes through the generated UpsertSettings (not the repo's public Upsert) to deliberately bypass the repo's update dispatch and history — this is init, not a user-initiated change.

Types

type OpenOption added in v0.9.9

type OpenOption func(*openOptions)

OpenOption configures how OpenDb builds the SQLite DSN.

func WithBusyTimeout added in v0.9.9

func WithBusyTimeout(d time.Duration) OpenOption

WithBusyTimeout sets SQLite's busy timeout pragma.

func WithJournalModeWAL added in v0.9.9

func WithJournalModeWAL() OpenOption

WithJournalModeWAL enables WAL journaling mode.

func WithSharedCache added in v0.9.9

func WithSharedCache() OpenOption

WithSharedCache enables SQLite shared-cache mode.

type SQLiteDB added in v0.9.9

type SQLiteDB interface {
	Read() *sql.DB
	Write() *sql.DB
	Close() error
}

func OpenDb

func OpenDb(dbPath string, opts ...OpenOption) (SQLiteDB, error)

OpenDb returns a split SQLite handle with separate read and write pools.

Directories

Path Synopsis
sqlc

Jump to

Keyboard shortcuts

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