Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExplainQueryResultRow ¶
type Inferrer ¶
type Inferrer struct {
// contains filtered or unexported fields
}
func NewInferrer ¶
NewInferrer infers information about a query by running the query on Postgres and extracting information from the catalog tables.
func (*Inferrer) InferTypes ¶
func (inf *Inferrer) InferTypes(query *ast.SourceQuery) (TypedQuery, error)
type InputParam ¶
type InputParam struct { // Name of the param, like 'FirstName' in pggen.arg('FirstName'). PgName string // The postgres type of this param as reported by Postgres. PgType pg.Type }
InputParam is an input parameter for a prepared query.
type OutputColumn ¶
type OutputColumn struct { // Name of an output column, named by Postgres, like "foo" in "SELECT 1 as foo". PgName string // The postgres type of the column as reported by Postgres. PgType pg.Type // If the type can be null; depends on the query. A column defined // with a NOT NULL constraint can still be null in the output with a left // join. Nullability is determined using rudimentary control-flow analysis. Nullable bool }
OutputColumn is a single column output from a select query or returning clause in an update, insert, or delete query.
type Plan ¶
type Plan struct { Type PlanType Relation string // target relation if any Outputs []string // the output expressions if any }
Plan is the plan output from an EXPLAIN query.
type PlanType ¶
type PlanType string
PlanType is the top-level node plan type that Postgres plans for executing query. https://www.postgresql.org/docs/13/executor.html
type TypedQuery ¶
type TypedQuery struct { // Name of the query, from the comment preceding the query. Like 'FindAuthors' // in the source SQL: "-- name: FindAuthors :many" Name string // The result output kind, :one, :many, or :exec. ResultKind ast.ResultKind // The comment lines preceding the query, without the SQL comment syntax and // excluding the :name line. Doc []string // The SQL query, with pggen functions replaced with Postgres syntax. Ready // to run on Postgres with the PREPARE statement. PreparedSQL string // The input parameters to the query. Inputs []InputParam // The output columns of the query. Outputs []OutputColumn // Qualified protocol buffer message type to use for each output row, like // "erp.api.Product". If empty, generate our own Row type. ProtobufType string }
TypedQuery is an enriched form of ast.SourceQuery after running it on Postgres to get information about the ast.SourceQuery.
Click to show internal directories.
Click to hide internal directories.