sqlite3

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: BSD-3-Clause Imports: 11 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 {
	// contains filtered or unexported fields
}

DB

func Open

func Open(filename string) (*DB, error)

Open a new DB connection.

func Up

func Up(ctx context.Context, filename string, fsys fs.FS) (*DB, error)

Up from the current version.

func (*DB) Close

func (db *DB) Close() error

Close closes the database and prevents new queries from starting.

func (*DB) DoTx

func (db *DB) DoTx(ctx context.Context, f func(context.Context, *Tx) error) error

DoTx begins a transaction.

FIXME issue with transaction already been committed

func (*DB) Exec

func (db *DB) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.

func (*DB) Query

func (db *DB) Query(ctx context.Context, query string, args ...any) (*sql.Rows, error)

Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.

func (*DB) QueryRow

func (db *DB) QueryRow(ctx context.Context, query string, args ...any) *sql.Row

QueryRow executes a query that is expected to return at most one row.

func (*DB) Tx

func (db *DB) Tx(ctx context.Context) (*Tx, error)

Tx

type Executor

type Executor interface {
	Exec(ctx context.Context, query string, args ...any) (sql.Result, error)
}

type FS

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

FS

func NewFS

func NewFS(fsys fs.FS, dir string) (*FS, error)

NewFS returns a FS

func (*FS) Up

func (fs *FS) Up(ctx context.Context, filename string) (*DB, error)

Up from the current version.

type Querier

type Querier interface {
	Query(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRow(ctx context.Context, query string, args ...any) *sql.Row
}

type Tx

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

Tx

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit the transaction.

func (*Tx) Exec

func (tx *Tx) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.

func (*Tx) Query

func (tx *Tx) Query(ctx context.Context, query string, args ...any) (*sql.Rows, error)

Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.

func (*Tx) QueryRow

func (tx *Tx) QueryRow(ctx context.Context, query string, args ...any) *sql.Row

QueryRow executes a query that is expected to return at most one row.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback the transaction.

Jump to

Keyboard shortcuts

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