analysis

package
v0.0.0-...-bdbe55d Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package analysis is the shape of an engine's answer about a query: the JSON `sqlc analyze` prints, so that a case's committed stdout.json can be compared with what the database itself reports, byte for byte.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(queries []Query) ([]byte, error)

Encode prints the answer the way sqlc analyze does.

Types

type Column

type Column struct {
	Name  string    `json:"name"`
	Type  *TypeExpr `json:"type,omitempty"`
	Table string    `json:"table,omitempty"`
}

Column describes a result column, or the column a parameter stands in for.

type Param

type Param struct {
	Number int    `json:"number"`
	Column Column `json:"column"`
}

Param is one parameter and what it is compared with or assigned to.

type Query

type Query struct {
	Name    string   `json:"name"`
	Cmd     string   `json:"cmd"`
	Columns []Column `json:"columns"`
	Params  []Param  `json:"params"`
}

Query is what was found out about one query.

type TypeArg

type TypeArg struct {
	Label  string    `json:"label,omitempty"`
	Type   *TypeExpr `json:"type,omitempty"`
	Int    *int64    `json:"int,omitempty"`
	Bool   *bool     `json:"bool,omitempty"`
	String *string   `json:"string,omitempty"`
	Ident  *string   `json:"ident,omitempty"`
}

TypeArg is one argument of a TypeExpr: a type, an integer, a boolean, a quoted string, or an identifier — a bare word that is not a type, such as the function an AggregateFunction names.

type TypeExpr

type TypeExpr struct {
	Name     string    `json:"name"`
	Nullable bool      `json:"nullable,omitempty"`
	Args     []TypeArg `json:"args,omitempty"`
}

TypeExpr is a type as a call expression: a lowercased name applied to an ordered argument list, each argument another type, an integer, a boolean or a quoted string, optionally labelled. Nullability is an attribute of the type rather than a wrapper.

Jump to

Keyboard shortcuts

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