sqlite

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package sqlite implements xmigrator using an application's database/sql SQLite engine. It deliberately does not import or register an engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MetadataPrefix               string
	BusyTimeout, LockWaitTimeout time.Duration
	Memory                       bool
	LockIdentity                 string
}

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func FromDB

func FromDB(db *sql.DB, cfg Config) (*Driver, error)

func (*Driver) ReadHistorySnapshot

func (d *Driver) ReadHistorySnapshot(ctx context.Context) (out []x.Record, err error)

func (*Driver) SQLDialect

func (*Driver) SQLDialect() string

func (*Driver) ValidateScript

func (d *Driver) ValidateScript(s x.Script) error

func (*Driver) WithSession

func (d *Driver) WithSession(ctx context.Context, fn func(x.Session[Tx]) error) (err error)

type Tx

type Tx interface {
	ExecContext(context.Context, string, ...any) (sql.Result, error)
	QueryContext(context.Context, string, ...any) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...any) *sql.Row
	PrepareContext(context.Context, string) (*sql.Stmt, error)
}

Tx is a pinned connection executor. Only the driver controls commit and rollback.

Jump to

Keyboard shortcuts

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