Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Conn string // connection name the statement ran on
Query string // the statement text
Columns []string // column names
Rows [][]string // display-ready values (NULL rendered as "NULL")
Raw [][]any // typed values, used for JSON export
Duration time.Duration // wall time for the statement
Truncated bool // true when the row limit was hit
IsExec bool // true for non-query statements (INSERT/UPDATE/...)
Affected int64 // rows affected, when IsExec
// Transposed marks a result turned on its side (export.Transpose): each
// row is one of the source's columns, its name in column 0, so the HTML
// renderings draw that column as row headers rather than as data.
Transposed bool
}
Result holds one tabular result set from a query or exec statement.
type Routine ¶ added in v0.10.0
type Routine struct {
Schema string
Name string
Kind RoutineKind
// Args is the argument list as declared, without its parentheses:
// "customer integer, since date DEFAULT now()"; "" for none.
Args string
// Result is what a function returns: "integer", "SETOF orders",
// "TABLE(id integer, total numeric)"; "" for a procedure.
Result string
}
Routine is a function or procedure stored in a database, as its catalog lists it: what completion offers beside the dialect's built-in functions. It lives here, not in db or sqlcomplete, because both use it — db reads it, sqlcomplete suggests it — and neither should import the other.
Args and Result are the engine's own rendering, kept as text: completion shows them and never parses them, so a structured form would be work for nothing.
type RoutineKind ¶ added in v0.10.0
type RoutineKind string
RoutineKind says how a routine is called.
const ( RoutineFunction RoutineKind = "function" // in an expression: f(x) RoutineProcedure RoutineKind = "procedure" // in a CALL statement RoutineAggregate RoutineKind = "aggregate" // in an expression, over rows RoutineWindow RoutineKind = "window" // in an expression, with OVER // RoutineTrigger is a function returning trigger or event_trigger: // it runs only from CREATE TRIGGER … EXECUTE FUNCTION, never in an // expression, so completion offers it after FUNCTION alone. RoutineTrigger RoutineKind = "trigger" )
Click to show internal directories.
Click to hide internal directories.