exprtest

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package exprtest holds the render-only fixtures that the tests of a feature package (arrayop, fts, ...) need to see the SQL and arguments of a predicate or expression: a one-column projection row and a DB over the recording fake driver. Nothing here runs a statement.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(name dialect.Name, p momo.Predicate) (momo.Compiled, error)

Compile renders the predicate in "SELECT COUNT(*) FROM docs WHERE p" for the dialect and returns the statement.

func CompileColumns

func CompileColumns(name dialect.Name, cols ...momo.Expr) (momo.Compiled, error)

CompileColumns renders "SELECT cols FROM documents" for the dialect and returns the statement, for tests of a value expression.

func DB

func DB(name dialect.Name) *momo.DB

DB opens a DB for the dialect over a driver that records statements and runs none.

Types

type Pair

type Pair struct {
	K int64
	N int64
}

Pair is a two-column projection fixture with no table of its own, for rendering a select list of an expression and a count, for example a grouped extraction. Select it with Columns(expr, momo.CountAll()).

func (*Pair) MomoMeta

func (*Pair) MomoMeta() *momo.Meta[Pair]

MomoMeta makes Pair a model for momo.Select.

type Tally

type Tally struct{ N int64 }

Tally is a projection fixture with a single count column and no table of its own. Select it with Columns(momo.CountAll()).

func (*Tally) MomoMeta

func (*Tally) MomoMeta() *momo.Meta[Tally]

MomoMeta makes Tally a model for momo.Select.

type TextTally

type TextTally struct {
	S string
	N int64
}

TextTally is a projection fixture with a text column and a count column, for statements that select a computed bucket next to COUNT(*).

func (*TextTally) MomoMeta

func (*TextTally) MomoMeta() *momo.Meta[TextTally]

MomoMeta makes TextTally a model for momo.Select.

Jump to

Keyboard shortcuts

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