verify

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package verify compares the analyzer's conclusion about a statement with a running PostgreSQL's: parameter types, result column names and types, and whether the statement is rejected (by SQLSTATE class). It is what pgtest.Verify runs for every expansion of an application's templates, and the same comparison the analyzer's golden tests make (those cannot import this package: it would cycle through analyze).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(want, got string) bool

Match compares the two renderings. Error lines only need the same SQLSTATE class prefix (first 5 chars of "error: 42XXX") to count as agreeing; messages are informative.

func RenderAnalyzer

func RenderAnalyzer(s *schema.Schema, sql string) string

RenderAnalyzer describes sql through the analyzer in the comparison format.

func RenderOracle

func RenderOracle(ctx context.Context, o *oracle.Oracle, sql string) string

RenderOracle describes sql through PostgreSQL in the comparison format.

Types

type Mismatch

type Mismatch struct {
	Template string // the template text
	Branch   string // which branches were taken ("" for a template without branches)
	SQL      string // the expanded SQL
	Oracle   string // PG's description (or "error: ...")
	Analyzer string // the analyzer's description (or "error: ...")
}

Mismatch is one expansion the analyzer and PostgreSQL disagree about.

func Template

func Template(ctx context.Context, o *oracle.Oracle, s *schema.Schema, tmpl string) ([]*Mismatch, error)

Template expands tmpl and compares every expansion. It returns one Mismatch per disagreeing expansion (nil when all agree) and an error when the template itself cannot be expanded.

func (*Mismatch) Error

func (m *Mismatch) Error() string

Jump to

Keyboard shortcuts

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