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 ¶
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 ¶
RenderAnalyzer describes sql through the analyzer 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.