sqlite

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sqlite implements a verify.Verifier backed by an in-memory modernc.org/sqlite database. It prepares each query against the catalog schema and reports per-column origin metadata via the driver's ColumnInfo extension.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PlanRow

type PlanRow struct {
	ID     int
	Parent int
	Detail string
}

PlanRow holds a single row returned by EXPLAIN QUERY PLAN. SQLite returns four columns (id, parent, notused, detail); notused is discarded. Detail describes the access method chosen for each step of the plan, e.g. "SCAN users" or "SEARCH users USING INDEX idx_users_email".

type Verifier

type Verifier struct{}

Verifier is a SQLite verify.Verifier.

func New

func New() *Verifier

New returns a new SQLite Verifier.

func (*Verifier) Dialect

func (v *Verifier) Dialect() string

Dialect reports the engine dialect served by this Verifier.

func (*Verifier) ExplainPlan

func (v *Verifier) ExplainPlan(ctx context.Context, catalog *model.Catalog, sql string) ([]PlanRow, error)

ExplainPlan loads the catalog DDL on a fresh in-memory connection, then runs EXPLAIN QUERY PLAN against sql and returns the resulting rows. The query itself is never executed — only the plan is obtained. On a SQLite prepare/query error the error is returned and the caller decides whether it is fatal.

func (*Verifier) Verify

func (v *Verifier) Verify(ctx context.Context, catalog *model.Catalog, queries []verify.Query) ([]verify.Result, error)

Verify opens an in-memory SQLite database, loads the catalog DDL, and prepares each query to extract column-origin metadata. One Result is returned per input query, in the same order. ParamCount is always 0 because modernc's NumInput() returns -1 and the internal count is unexported (params stay static in the Overlay).

Jump to

Keyboard shortcuts

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