mqsqlite

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mqsqlite is the database/sql adapter for metaquery builders targeting SQLite. It executes a *metaquery.Builder and returns an untyped Result or a typed TypedResult[T] using only the standard library.

The adapter is driver-agnostic: it works with any database/sql driver registered for SQLite (e.g. modernc.org/sqlite, mattn/go-sqlite3, libsql). The wrapped query's Dialect must be metaquery.DialectSQLite so the Builder emits SQLite-compatible ?N placeholders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

Run executes b and returns every row as a positional []any in the same order as Meta.Columns. If b.WantsTotal(), a follow-up COUNT(*) is issued and Meta.Pagination.Total is populated.

func Scan

Scan executes b, scans rows into []T using `db` struct tags (snake_case fallback), and returns a TypedResult with the same Meta envelope as Run. T is validated against b.OutputColumns() before querying.

func ScanOne

func ScanOne[T any](ctx context.Context, q Queryer, b *metaquery.Builder) (T, metaquery.Meta, error)

ScanOne runs b expecting exactly one row and returns the scanned T plus the Meta envelope.

Types

type Queryer

type Queryer interface {
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

Queryer is the minimal database/sql surface the adapter needs. Implemented by *sql.DB, *sql.Tx, and *sql.Conn.

Jump to

Keyboard shortcuts

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