sqldriver

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sqldriver adapts any database/sql connection to driver.Driver. It backs the libSQL/Turso driver and the public WithSQLDB option, which lets a caller supply a driver drel does not depend on.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPoolConfig

func ApplyPoolConfig(db *sql.DB, pc ...driver.PoolConfig)

ApplyPoolConfig applies the non-zero pool settings to the handle.

Types

type Driver

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

Driver implements driver.Driver over a database/sql handle.

func New

func New(db *sql.DB) *Driver

New wraps an open *sql.DB. The caller owns the handle's configuration; Close closes it.

func (*Driver) Begin

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

func (*Driver) BeginTx

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

BeginTx starts a transaction. An SQLite-compatible database supports only SERIALIZABLE isolation, so the requested level is ignored; the ReadOnly flag is forwarded.

func (*Driver) Close

func (d *Driver) Close()

func (*Driver) DB

func (d *Driver) DB() *sql.DB

DB returns the wrapped handle.

func (*Driver) Exec

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

func (*Driver) Ping

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

Ping verifies a working connection to the database.

func (*Driver) Query

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

func (*Driver) QueryRow

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

func (*Driver) Stat

func (d *Driver) 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