sqlite

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 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 Connection

type Connection interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
}

Connection is the database/sql behavior required by generated queries.

type Query

type Query[T any] struct {
	SQL      string
	StmtName string
	Args     []any
	Error    error
}

Query is an executable generated SQLite query returning T.

func Retype

func Retype[To any, From any](q *Query[From]) *Query[To]

Retype returns a Query with a result type of a compatible shape.

func (*Query[T]) Execute

func (q *Query[T]) Execute(ctx context.Context, c Connection) (int64, error)

Execute runs q and returns the affected row count.

func (*Query[T]) Get

func (q *Query[T]) Get(ctx context.Context, c Connection) ([]T, error)

Get executes q and maps every returned row.

func (*Query[T]) GetOne

func (q *Query[T]) GetOne(ctx context.Context, c Connection) (*T, error)

GetOne executes the query and enforces only a single result is returned.

type Transaction

type Transaction interface {
	Connection
	Commit() error
	Rollback() error
}

Transaction is a transactional Connection.

Jump to

Keyboard shortcuts

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