match

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package match compiles a query.Where (fabriq's engine-neutral filter AST) into a Go predicate evaluated against a column-keyed map. It is the hot-path twin of the SQL the postgres adapter generates from the same Where, so a live query's membership test and its snapshot/refill SQL share one source of truth. The matchtest parity suite asserts Go-eval ≡ Postgres WHERE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Order

func Order(a, b any) int

Order returns -1/0/1 for order-comparable values; unordered pairs return 0. It exposes the package's internal comparison so the livequery package can order cursors with the exact same semantics the predicate evaluator uses.

Types

type Predicate

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

Predicate evaluates a compiled filter against a column-keyed row.

func Compile

func Compile(w query.Where) (Predicate, error)

Compile validates the operator vocabulary (column validation belongs upstream in query.ValidateConds) and returns an evaluator over the conjunction of conds.

func (Predicate) Eval

func (p Predicate) Eval(row map[string]any) bool

Eval reports whether row satisfies every top-level condition (AND).

Jump to

Keyboard shortcuts

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