sqlite

package
v0.0.0-...-ccfd39c Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Now func() time.Time
	// contains filtered or unexported fields
}

DB represents an SQLite database connection.

func (*DB) BeginTx

func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx starts a transaction.

func (*DB) Open

func (db *DB) Open() (err error)

Open opens reading and writing database connections and executes any outstanding database migrations.

type MainDB

type MainDB struct {
	DB
}

MainDB represents the main database where permanent data is stored.

func NewMainDB

func NewMainDB(path string, logger *slog.Logger) *MainDB

NewMainDB returns a new instance of DB for the main database.

type NullTime

type NullTime time.Time

NullTime represents a wrapper around time.Time, providing support for storing and reading time values formatted using time.RFC3339 to and from SQLite databases. NULL values are converted to zero-value times.

func (*NullTime) Scan

func (n *NullTime) Scan(src any) error

Scan implements the sql.Scanner interface.

func (*NullTime) Value

func (n *NullTime) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Tx

type Tx struct {
	*sql.Tx
	Now time.Time
}

Tx provides a sql.Tx and a transaction start timestamp.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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