sqlitedriver

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLiteDriver

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

SQLiteDriver implements driver.Driver using database/sql with the modernc.org/sqlite pure-Go driver.

func New

func New(dsn string, pc ...driver.PoolConfig) (*SQLiteDriver, error)

New opens a SQLite database at the given DSN and enables WAL mode. No context is required for connection — SQLite is an embedded database.

func (*SQLiteDriver) Begin

func (d *SQLiteDriver) Begin(ctx context.Context) (driver.Tx, error)

Begin starts a new database transaction with default options.

func (*SQLiteDriver) BeginTx

func (d *SQLiteDriver) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

BeginTx starts a new database transaction with the given options. SQLite only supports SERIALIZABLE isolation, so the isolation level is ignored. Only the ReadOnly flag is forwarded.

func (*SQLiteDriver) Close

func (d *SQLiteDriver) Close()

Close closes the underlying database connection.

func (*SQLiteDriver) Exec

func (d *SQLiteDriver) Exec(ctx context.Context, query string, args ...any) (int64, error)

Exec executes a statement and returns the number of affected rows.

func (*SQLiteDriver) Ping added in v0.5.0

func (d *SQLiteDriver) Ping(ctx context.Context) error

Ping verifies a working connection to the database.

func (*SQLiteDriver) Query

func (d *SQLiteDriver) Query(ctx context.Context, query string, args ...any) (driver.Rows, error)

Query executes a query that returns multiple rows.

func (*SQLiteDriver) QueryRow

func (d *SQLiteDriver) QueryRow(ctx context.Context, query string, args ...any) driver.Row

QueryRow executes a query that returns at most one row.

func (*SQLiteDriver) Stat added in v0.5.0

func (d *SQLiteDriver) Stat() driver.PoolStat

Stat returns a snapshot of the database/sql connection pool.

Jump to

Keyboard shortcuts

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