Documentation
¶
Index ¶
- Variables
- func As[T any](node SyntaxNode) (T, error)
- func AsOptionalIdentifier(identifier Identifier) models.Optional[Identifier]
- func DeletedPropertiesToString(properties *graph.Properties) string
- func IDSliceToInt8Array(value []graph.ID) (pgtype.Int8Array, error)
- func Int32SliceToInt4Array(value []int32) (pgtype.Int4Array, error)
- func IsAggregateFunction(function Identifier) bool
- func IsReservedIdentifier(identifier Identifier) bool
- func JSONBToProperties(jsonb pgtype.JSONB) (*graph.Properties, error)
- func MapStringAnyToJSONB(values map[string]any) (pgtype.JSONB, error)
- func MatcherAsJSONB(fieldName string, value any) (pgtype.JSONB, error)
- func MustMatcherAsJSONB(fieldName string, value any) pgtype.JSONB
- func NegotiateValue(value any) (any, error)
- func OperatorIsBoolean(operator Expression) bool
- func OperatorIsComparator(operator Expression) bool
- func OperatorIsIn(operator Expression, matchers ...Expression) bool
- func OperatorIsPropertyLookup(operator Expression) bool
- func PropertiesToJSONB(properties *graph.Properties) (pgtype.JSONB, error)
- func StringSliceToTextArray(values []string) (pgtype.TextArray, error)
- func ValueToJSONB(value any) (pgtype.JSONB, error)
- type AliasedExpression
- type AllExpression
- type AnyExpression
- type ArrayExpression
- type ArrayIndex
- type ArrayLiteral
- type ArraySlice
- type Assignment
- type Between
- type BinaryExpression
- type Case
- type CommonTableExpression
- type CompositeValue
- type CompoundIdentifier
- func (s CompoundIdentifier) AsExpression() Expression
- func (s CompoundIdentifier) AsSelectItem() SelectItem
- func (s CompoundIdentifier) Copy() CompoundIdentifier
- func (s CompoundIdentifier) Field() Identifier
- func (s CompoundIdentifier) HasField() bool
- func (s CompoundIdentifier) IsBlank() bool
- func (s CompoundIdentifier) NodeType() string
- func (s CompoundIdentifier) Root() Identifier
- func (s CompoundIdentifier) String() string
- func (s CompoundIdentifier) Strings() []string
- type ConflictAction
- type ConflictTarget
- type DataType
- func (s DataType) ArrayBaseType() DataType
- func (s DataType) CoerceToSupertype(other DataType) (DataType, bool)
- func (s DataType) IsArrayType() bool
- func (s DataType) IsComparable(other DataType, operator Operator) bool
- func (s DataType) IsKnown() bool
- func (s DataType) IsTemporalType() bool
- func (s DataType) MatchesOneOf(others ...DataType) bool
- func (s DataType) NodeType() string
- func (s DataType) OperatorResultType(other DataType, operator Operator) (DataType, bool)
- func (s DataType) String() string
- func (s DataType) TemporalIntervalArithmeticResultType() DataType
- func (s DataType) ToArrayType() (DataType, error)
- type Delete
- type DoNothing
- type DoUpdate
- type EdgeArrayFromPathIDs
- type ExistsExpression
- type Expression
- type FormattingLiteral
- type FromClause
- type FunctionCall
- type Future
- type Identifier
- type IdentifierSet
- func (s *IdentifierSet) Add(identifiers ...Identifier) *IdentifierSet
- func (s *IdentifierSet) CheckedAdd(identifier Identifier) bool
- func (s *IdentifierSet) Clear()
- func (s *IdentifierSet) CombinedKey() Identifier
- func (s *IdentifierSet) Contains(other Identifier) bool
- func (s *IdentifierSet) Copy() *IdentifierSet
- func (s *IdentifierSet) IsEmpty() bool
- func (s *IdentifierSet) Len() int
- func (s *IdentifierSet) Matches(other *IdentifierSet) bool
- func (s *IdentifierSet) MergeSet(other *IdentifierSet) *IdentifierSet
- func (s *IdentifierSet) Remove(others ...Identifier) *IdentifierSet
- func (s *IdentifierSet) RemoveSet(other *IdentifierSet) *IdentifierSet
- func (s *IdentifierSet) Satisfies(other *IdentifierSet) bool
- func (s *IdentifierSet) Slice() []Identifier
- func (s *IdentifierSet) Strings() []string
- type InExpression
- type InSubquery
- type Insert
- type Join
- type JoinOperator
- type JoinType
- type KindListLiteral
- type KindMapper
- type LateralSubquery
- type Literal
- type LiteralNodeValue
- type MatchedDelete
- type MatchedUpdate
- type Materialized
- type Merge
- type MergeAction
- type MissingKindsError
- type OnConflict
- type Operator
- type OrderBy
- type Parameter
- type Parenthetical
- type Projection
- type ProjectionFrom
- type PropertyKey
- type Query
- type RecordShape
- type RowColumnReference
- type Select
- type SelectItem
- type SetExpression
- type SetOperation
- type Statement
- type Subquery
- type SymbolTable
- func (s *SymbolTable) Add(symbol any)
- func (s *SymbolTable) AddCompoundIdentifier(identifier CompoundIdentifier)
- func (s *SymbolTable) AddIdentifier(identifier Identifier)
- func (s *SymbolTable) AddTable(symbols *SymbolTable)
- func (s *SymbolTable) Contains(symbol any) bool
- func (s *SymbolTable) EachCompoundIdentifier(each func(next CompoundIdentifier) bool)
- func (s *SymbolTable) EachIdentifier(each func(next Identifier) bool)
- func (s *SymbolTable) IsEmpty() bool
- func (s *SymbolTable) NotIn(exclusions *SymbolTable) *SymbolTable
- func (s *SymbolTable) RootIdentifiers() *IdentifierSet
- type SyntaxNode
- type SyntaxNodeFuture
- type TableAlias
- type TableReference
- type TypeCast
- type TypeHinted
- type UnaryExpression
- type UnmatchedAction
- type Update
- type Values
- type Variadic
- type Wildcard
- type Window
- type WindowFrame
- type WindowFrameBoundary
- type WindowFrameBoundaryType
- type WindowFrameUnit
- type With
- type WrappedNode
Constants ¶
This section is empty.
Variables ¶
var ( NodeTableColumns = []Identifier{ ColumnID, ColumnKindIDs, ColumnProperties, } EdgeTableColumns = []Identifier{ ColumnID, ColumnStartID, ColumnEndID, ColumnKindID, ColumnProperties, } )
var CompositeTypes = []DataType{NodeComposite, NodeCompositeArray, EdgeComposite, EdgeCompositeArray, PathComposite}
var ErrNoAvailableArrayDataType = errors.New("data type has no direct array representation")
Functions ¶
func As ¶
func As[T any](node SyntaxNode) (T, error)
As is a helper function that takes a SyntaxNode and attempts to cast it to the type represented by T. If the node passed is equal to nil then the empty value of T is returned. If the typed node does not convert to the type represented by T then an error is returned.
func AsOptionalIdentifier ¶
func AsOptionalIdentifier(identifier Identifier) models.Optional[Identifier]
func DeletedPropertiesToString ¶ added in v0.4.12
func DeletedPropertiesToString(properties *graph.Properties) string
func IsAggregateFunction ¶
func IsAggregateFunction(function Identifier) bool
IsAggregateFunction reports whether function is one of the aggregate functions recognized by the SQL model.
func IsReservedIdentifier ¶
func IsReservedIdentifier(identifier Identifier) bool
func JSONBToProperties ¶
func JSONBToProperties(jsonb pgtype.JSONB) (*graph.Properties, error)
func NegotiateValue ¶
func OperatorIsBoolean ¶
func OperatorIsBoolean(operator Expression) bool
func OperatorIsComparator ¶
func OperatorIsComparator(operator Expression) bool
func OperatorIsIn ¶
func OperatorIsIn(operator Expression, matchers ...Expression) bool
func OperatorIsPropertyLookup ¶
func OperatorIsPropertyLookup(operator Expression) bool
func PropertiesToJSONB ¶
func PropertiesToJSONB(properties *graph.Properties) (pgtype.JSONB, error)
func StringSliceToTextArray ¶
Types ¶
type AliasedExpression ¶
type AliasedExpression struct {
Expression Expression
Alias models.Optional[Identifier]
}
func (AliasedExpression) AsExpression ¶
func (s AliasedExpression) AsExpression() Expression
func (AliasedExpression) AsSelectItem ¶
func (s AliasedExpression) AsSelectItem() SelectItem
func (AliasedExpression) NodeType ¶
func (s AliasedExpression) NodeType() string
type AllExpression ¶
type AllExpression struct {
Expression
}
func NewAllExpression ¶
func NewAllExpression(inner Expression) AllExpression
type AnyExpression ¶
type AnyExpression struct {
Expression
CastType DataType
}
func NewAnyExpression ¶
func NewAnyExpression(inner Expression, castType DataType) *AnyExpression
func NewAnyExpressionHinted ¶
func NewAnyExpressionHinted(inner TypeHinted) *AnyExpression
func (AnyExpression) AsExpression ¶
func (s AnyExpression) AsExpression() Expression
func (AnyExpression) NodeType ¶
func (s AnyExpression) NodeType() string
func (AnyExpression) TypeHint ¶
func (s AnyExpression) TypeHint() DataType
type ArrayExpression ¶
type ArrayExpression struct {
Expression Expression
}
func (ArrayExpression) AsExpression ¶
func (s ArrayExpression) AsExpression() Expression
func (ArrayExpression) NodeType ¶
func (s ArrayExpression) NodeType() string
type ArrayIndex ¶
type ArrayIndex struct {
Expression Expression
Indexes []Expression
CastType DataType
}
func (ArrayIndex) AsExpression ¶
func (s ArrayIndex) AsExpression() Expression
func (ArrayIndex) NodeType ¶
func (s ArrayIndex) NodeType() string
func (ArrayIndex) TypeHint ¶ added in v0.5.0
func (s ArrayIndex) TypeHint() DataType
type ArrayLiteral ¶
type ArrayLiteral struct {
Values []Expression
CastType DataType
}
func NewArrayLiteral ¶
func NewArrayLiteral[T any](values []T, castType DataType) (ArrayLiteral, error)
func (ArrayLiteral) AsExpression ¶
func (s ArrayLiteral) AsExpression() Expression
func (ArrayLiteral) AsSelectItem ¶
func (s ArrayLiteral) AsSelectItem() SelectItem
func (ArrayLiteral) NodeType ¶
func (s ArrayLiteral) NodeType() string
func (ArrayLiteral) TypeHint ¶
func (s ArrayLiteral) TypeHint() DataType
type ArraySlice ¶ added in v0.5.0
type ArraySlice struct {
Expression Expression
Lower Expression
Upper Expression
CastType DataType
}
func (ArraySlice) AsExpression ¶ added in v0.5.0
func (s ArraySlice) AsExpression() Expression
func (ArraySlice) AsSelectItem ¶ added in v0.5.0
func (s ArraySlice) AsSelectItem() SelectItem
func (ArraySlice) NodeType ¶ added in v0.5.0
func (s ArraySlice) NodeType() string
func (ArraySlice) TypeHint ¶ added in v0.5.0
func (s ArraySlice) TypeHint() DataType
type Assignment ¶
type Assignment interface {
SyntaxNode
AsAssignment() Assignment
}
Assignment is an expression that can be used as an assignment.
type Between ¶
type Between struct {
Expression Expression
Low Expression
High Expression
Negated bool
}
Between represents a comparison expression between a low expression and high expression. <expr> [not] between <low> and <high>
type BinaryExpression ¶
type BinaryExpression struct {
Operator Operator
LOperand Expression
ROperand Expression
}
<expr> > <expr> table.column > 12345
func NewBinaryExpression ¶
func NewBinaryExpression(left Expression, operator Operator, right Expression) *BinaryExpression
func NewJSONTextFieldLookup ¶
func NewJSONTextFieldLookup(reference CompoundIdentifier, field Identifier) *BinaryExpression
func NewPropertyLookup ¶
func NewPropertyLookup(identifier CompoundIdentifier, reference Literal) *BinaryExpression
func (BinaryExpression) AsAssignment ¶
func (s BinaryExpression) AsAssignment() Assignment
func (BinaryExpression) AsExpression ¶
func (s BinaryExpression) AsExpression() Expression
func (BinaryExpression) AsSelectItem ¶
func (s BinaryExpression) AsSelectItem() SelectItem
func (BinaryExpression) NodeType ¶
func (s BinaryExpression) NodeType() string
type Case ¶
type Case struct {
Operand Expression
Conditions []Expression
Then []Expression
Else Expression
}
Case represents a pattern matching syntax node:
CASE
WHEN condition1 THEN result1 WHEN condition2 THEN result2 WHEN conditionN THEN resultN ELSE result
END;
func (Case) AsExpression ¶ added in v0.5.0
func (s Case) AsExpression() Expression
func (Case) AsSelectItem ¶ added in v0.5.0
func (s Case) AsSelectItem() SelectItem
type CommonTableExpression ¶
type CommonTableExpression struct {
Alias TableAlias
Materialized *Materialized
Query Query
}
CommonTableExpression is a named component of a `WITH` query and provides a way to write auxiliary statements for use in a larger query
func (CommonTableExpression) NodeType ¶
func (s CommonTableExpression) NodeType() string
type CompositeValue ¶
type CompositeValue struct {
Values []Expression
DataType DataType
}
func (CompositeValue) AsExpression ¶
func (s CompositeValue) AsExpression() Expression
func (CompositeValue) AsSelectItem ¶
func (s CompositeValue) AsSelectItem() SelectItem
func (CompositeValue) NodeType ¶
func (s CompositeValue) NodeType() string
func (CompositeValue) TypeHint ¶ added in v0.5.0
func (s CompositeValue) TypeHint() DataType
type CompoundIdentifier ¶
type CompoundIdentifier []Identifier
func AsCompoundIdentifier ¶
func AsCompoundIdentifier[T string | Identifier](parts ...T) CompoundIdentifier
func (CompoundIdentifier) AsExpression ¶
func (s CompoundIdentifier) AsExpression() Expression
func (CompoundIdentifier) AsSelectItem ¶
func (s CompoundIdentifier) AsSelectItem() SelectItem
func (CompoundIdentifier) Copy ¶
func (s CompoundIdentifier) Copy() CompoundIdentifier
func (CompoundIdentifier) Field ¶
func (s CompoundIdentifier) Field() Identifier
func (CompoundIdentifier) HasField ¶
func (s CompoundIdentifier) HasField() bool
func (CompoundIdentifier) IsBlank ¶
func (s CompoundIdentifier) IsBlank() bool
func (CompoundIdentifier) NodeType ¶
func (s CompoundIdentifier) NodeType() string
func (CompoundIdentifier) Root ¶
func (s CompoundIdentifier) Root() Identifier
func (CompoundIdentifier) String ¶
func (s CompoundIdentifier) String() string
func (CompoundIdentifier) Strings ¶
func (s CompoundIdentifier) Strings() []string
type ConflictAction ¶
type ConflictAction interface {
Expression
AsConflictAction() ConflictAction
}
ConflictAction is an expression that is evaluated as part of an OnConflict expression.
type ConflictTarget ¶
type ConflictTarget struct {
Columns []Expression
Constraint CompoundIdentifier
}
func (ConflictTarget) AsExpression ¶
func (s ConflictTarget) AsExpression() Expression
func (ConflictTarget) NodeType ¶
func (s ConflictTarget) NodeType() string
type DataType ¶
type DataType string
const ( // UnsetDataType represents a DataType that has not been visited by any logic. It is the default, zero-value for // the DataType type. UnsetDataType DataType = "" // UnknownDataType represents a DataType that has been visited by type inference logic but remains unknowable. UnknownDataType DataType = "unknown" Null DataType = "null" Any DataType = "any" NodeComposite DataType = "nodecomposite" EdgeComposite DataType = "edgecomposite" PathComposite DataType = "pathcomposite" Int DataType = "int" Int2 DataType = "int2" Int4 DataType = "int4" Int8 DataType = "int8" Float4 DataType = "float4" Float8 DataType = "float8" Boolean DataType = "bool" Text DataType = "text" JSONB DataType = "jsonb" Numeric DataType = "numeric" AnyArray DataType = "anyarray" NodeCompositeArray DataType = "nodecomposite[]" EdgeCompositeArray DataType = "edgecomposite[]" IntArray DataType = "int[]" Int2Array DataType = "int2[]" Int4Array DataType = "int4[]" Int8Array DataType = "int8[]" Float4Array DataType = "float4[]" Float8Array DataType = "float8[]" TextArray DataType = "text[]" JSONBArray DataType = "jsonb[]" NumericArray DataType = "numeric[]" Date DataType = "date" TimeWithTimeZone DataType = "time with time zone" TimeWithoutTimeZone DataType = "time without time zone" Interval DataType = "interval" TimestampWithTimeZone DataType = "timestamp with time zone" TimestampWithoutTimeZone DataType = "timestamp without time zone" Scope DataType = "scope" ParameterIdentifier DataType = "parameter_identifier" ExpansionPattern DataType = "expansion_pattern" ExpansionPath DataType = "expansion_path" ExpansionRootNode DataType = "expansion_root_node" ExpansionEdge DataType = "expansion_edge" ExpansionTerminalNode DataType = "expansion_terminal_node" PathEdge DataType = "path_edge" )
func ValueToDataType ¶
func (DataType) ArrayBaseType ¶
func (DataType) CoerceToSupertype ¶
CoerceToSupertype attempts to take the super of the type s and the type other
func (DataType) IsArrayType ¶
func (DataType) IsComparable ¶
func (DataType) IsTemporalType ¶ added in v0.5.0
func (DataType) MatchesOneOf ¶
func (DataType) OperatorResultType ¶
func (DataType) TemporalIntervalArithmeticResultType ¶ added in v0.5.0
func (DataType) ToArrayType ¶
type Delete ¶
type Delete struct {
From []TableReference
Using []FromClause
Where Expression
Returning []SelectItem
}
Delete is a SQL statement that is evaluated to remove data from a target table.
func (Delete) AsExpression ¶
func (s Delete) AsExpression() Expression
func (Delete) AsSetExpression ¶
func (s Delete) AsSetExpression() SetExpression
func (Delete) AsStatement ¶
type DoUpdate ¶
type DoUpdate struct {
Assignments []Assignment
Where Expression
}
func (DoUpdate) AsConflictAction ¶
func (s DoUpdate) AsConflictAction() ConflictAction
func (DoUpdate) AsExpression ¶
func (s DoUpdate) AsExpression() Expression
type EdgeArrayFromPathIDs ¶ added in v0.6.0
type EdgeArrayFromPathIDs struct {
// PathIDs is the ordered edge-ID array to hydrate.
PathIDs Expression
// GraphID identifies the graph whose edge IDs are hydrated into edge composites.
GraphID Expression
}
EdgeArrayFromPathIDs hydrates edge composites from a path's ordered edge identifiers.
func (*EdgeArrayFromPathIDs) AsExpression ¶ added in v0.6.0
func (s *EdgeArrayFromPathIDs) AsExpression() Expression
func (*EdgeArrayFromPathIDs) NodeType ¶ added in v0.6.0
func (s *EdgeArrayFromPathIDs) NodeType() string
type ExistsExpression ¶
ExistsExpression is an expression that is wrapped by an exists unary expression that can be optionally negated.
[not] exists(<query>)
func (ExistsExpression) AsExpression ¶
func (s ExistsExpression) AsExpression() Expression
func (ExistsExpression) AsSelectItem ¶
func (s ExistsExpression) AsSelectItem() SelectItem
func (ExistsExpression) NodeType ¶
func (s ExistsExpression) NodeType() string
type Expression ¶
type Expression interface {
SyntaxNode
AsExpression() Expression
}
Expression one or more syntax nodes that evaluate to a value.
func OptionalAnd ¶
func OptionalAnd(leftOperand Expression, rightOperand Expression) Expression
func OptionalBinaryExpressionJoin ¶
func OptionalBinaryExpressionJoin(optional Expression, operator Operator, conjoined Expression) Expression
func OptionalParenthetical ¶ added in v0.6.0
func OptionalParenthetical(optional Expression) Expression
type FormattingLiteral ¶
type FormattingLiteral string
FormattingLiteral is a syntax node that is used as a transparent formatting syntax node. The formatter will take the string value and emit it as-is.
func (FormattingLiteral) AsExpression ¶
func (s FormattingLiteral) AsExpression() Expression
func (FormattingLiteral) NodeType ¶
func (s FormattingLiteral) NodeType() string
func (FormattingLiteral) String ¶
func (s FormattingLiteral) String() string
type FromClause ¶
type FromClause struct {
Source Expression
Joins []Join
}
func (FromClause) NodeType ¶
func (s FromClause) NodeType() string
type FunctionCall ¶
type FunctionCall struct {
// Bare omits the usual argument parentheses for SQL keyword-like functions.
Bare bool
// Distinct deduplicates argument rows before aggregate evaluation.
Distinct bool
// Function identifies the PostgreSQL function to invoke.
Function Identifier
// Parameters contains the function arguments in call order.
Parameters []Expression
// OrderBy orders aggregate inputs before the function is evaluated.
OrderBy []*OrderBy
// Over supplies the window specification for a window-function call.
Over *Window
// CastType records the function result type known to the translator.
CastType DataType
}
FunctionCall represents a PostgreSQL function invocation and its aggregate or window options.
func (FunctionCall) AsAssignment ¶
func (s FunctionCall) AsAssignment() Assignment
func (FunctionCall) AsExpression ¶
func (s FunctionCall) AsExpression() Expression
func (FunctionCall) AsSelectItem ¶
func (s FunctionCall) AsSelectItem() SelectItem
func (FunctionCall) NodeType ¶
func (s FunctionCall) NodeType() string
func (FunctionCall) TypeHint ¶
func (s FunctionCall) TypeHint() DataType
type Future ¶
type Future[U any] struct { SyntaxNode SyntaxNode Data U DataType DataType }
func (Future[U]) AsExpression ¶
func (s Future[U]) AsExpression() Expression
func (Future[U]) Unwrap ¶
func (s Future[U]) Unwrap() SyntaxNode
type Identifier ¶
type Identifier string
const ( // FunctionUnidirectionalASPHarness identifies the SQL harness for unidirectional all-shortest-path search. FunctionUnidirectionalASPHarness Identifier = "unidirectional_asp_harness" // FunctionUnidirectionalSPHarness identifies the SQL harness for unidirectional single-shortest-path search. FunctionUnidirectionalSPHarness Identifier = "unidirectional_sp_harness" // FunctionBidirectionalASPHarness identifies the SQL harness for bidirectional all-shortest-path search. FunctionBidirectionalASPHarness Identifier = "bidirectional_asp_harness" // FunctionBidirectionalSPHarness identifies the SQL harness for bidirectional single-shortest-path search. FunctionBidirectionalSPHarness Identifier = "bidirectional_sp_harness" // FunctionAllShortestPathsDAG identifies the SQL helper that materializes every shortest path from a predecessor DAG. FunctionAllShortestPathsDAG Identifier = "all_shortest_paths_dag" // FunctionAllShortestPathsNoPathProbe identifies the bounded target-side // reachability preflight. It returns an exact empty result only after the // reverse component is exhausted; every positive or capped probe delegates // to the A1 predecessor-DAG helper. FunctionAllShortestPathsNoPathProbe Identifier = "all_shortest_paths_no_path_probe" // FunctionShortestPathCompact identifies the SQL helper that materializes one compact shortest-path witness. FunctionShortestPathCompact Identifier = "shortest_path_compact" // FunctionShortestPathB1StrictAlternating identifies compact bidirectional search with strict node alternation. FunctionShortestPathB1StrictAlternating Identifier = "shortest_path_b1_strict_alternating" // FunctionShortestPathB2SmallerCurrentLevel identifies compact bidirectional search that expands the smaller current level. FunctionShortestPathB2SmallerCurrentLevel Identifier = "shortest_path_b2_smaller_current_level" // FunctionAllShortestPathsB1StrictAlternating identifies two-sided predecessor-DAG enumeration with strict node alternation. FunctionAllShortestPathsB1StrictAlternating Identifier = "all_shortest_paths_b1_strict_alternating" // FunctionAllShortestPathsB2SmallerCurrentLevel identifies two-sided predecessor-DAG enumeration that expands the smaller current level. FunctionAllShortestPathsB2SmallerCurrentLevel Identifier = "all_shortest_paths_b2_smaller_current_level" // FunctionShortestPathSelfEndpointError identifies the SQL helper that raises an invalid self-endpoint error. FunctionShortestPathSelfEndpointError Identifier = "shortest_path_self_endpoint_error" // FunctionIntArrayUnique identifies the SQL helper that removes duplicate integer-array values. FunctionIntArrayUnique Identifier = "uniq" // FunctionIntArraySort identifies the SQL helper that orders integer-array values. FunctionIntArraySort Identifier = "sort" // FunctionJSONBToTextArray identifies the SQL helper that converts a JSONB array to text[]. FunctionJSONBToTextArray Identifier = "jsonb_to_text_array" // FunctionJSONBArrayElementsText identifies PostgreSQL's JSONB array-element text expansion function. FunctionJSONBArrayElementsText Identifier = "jsonb_array_elements_text" // FunctionJSONBBuildObject identifies PostgreSQL's JSONB object constructor. FunctionJSONBBuildObject Identifier = "jsonb_build_object" // FunctionJSONBBuildArray constructs an array without reinterpreting element types. FunctionJSONBBuildArray Identifier = "jsonb_build_array" // FunctionJSONBArrayElements expands JSON arrays while preserving element types. FunctionJSONBArrayElements Identifier = "jsonb_array_elements" // FunctionJSONBArrayLength identifies PostgreSQL's JSONB array-length function. FunctionJSONBArrayLength Identifier = "jsonb_array_length" // FunctionJSONBTypeof identifies PostgreSQL's JSONB type-inspection function. FunctionJSONBTypeof Identifier = "jsonb_typeof" // FunctionToJSONB identifies PostgreSQL's conversion to JSONB. FunctionToJSONB Identifier = "to_jsonb" // FunctionTrunc removes the fractional part without rounding. FunctionTrunc Identifier = "trunc" // FunctionCypherText extracts a runtime string or explicitly converts a scalar. FunctionCypherText Identifier = "cypher_text" // FunctionCharLength counts Unicode characters in a string. FunctionCharLength Identifier = "char_length" // FunctionCypherList validates a runtime list without changing element types. FunctionCypherList Identifier = "cypher_list" // FunctionCypherSize returns the length of a runtime string or list. FunctionCypherSize Identifier = "cypher_size" // FunctionCypherCompare compares compatible runtime values, returning null for unlike types. FunctionCypherCompare Identifier = "cypher_compare" // FunctionCypherArithmetic evaluates arithmetic using the runtime JSON value types. FunctionCypherArithmetic Identifier = "cypher_arithmetic" // FunctionCypherContains identifies the SQL helper implementing Cypher CONTAINS semantics. FunctionCypherContains Identifier = "cypher_contains" // FunctionCypherStartsWith identifies the SQL helper implementing Cypher STARTS WITH semantics. FunctionCypherStartsWith Identifier = "cypher_starts_with" // FunctionCypherEndsWith identifies the SQL helper implementing Cypher ENDS WITH semantics. FunctionCypherEndsWith Identifier = "cypher_ends_with" // FunctionCypherMin identifies the SQL aggregate implementing Cypher minimum semantics. FunctionCypherMin Identifier = "cypher_min" // FunctionCypherMax identifies the SQL aggregate implementing Cypher maximum semantics. FunctionCypherMax Identifier = "cypher_max" // FunctionCypherSum sums runtime numbers without converting integers to floats. FunctionCypherSum Identifier = "cypher_sum" // FunctionArrayLength identifies PostgreSQL's dimension-aware array-length function. FunctionArrayLength Identifier = "array_length" // FunctionCardinality identifies PostgreSQL's total array-element count function. FunctionCardinality Identifier = "cardinality" // FunctionArrayAggregate identifies PostgreSQL's array aggregation function. FunctionArrayAggregate Identifier = "array_agg" // FunctionArrayRemove identifies PostgreSQL's array element-removal function. FunctionArrayRemove Identifier = "array_remove" // FunctionMin identifies PostgreSQL's minimum aggregate. FunctionMin Identifier = "min" // FunctionMax identifies PostgreSQL's maximum aggregate. FunctionMax Identifier = "max" // FunctionSum identifies PostgreSQL's sum aggregate. FunctionSum Identifier = "sum" // FunctionAvg identifies PostgreSQL's average aggregate. FunctionAvg Identifier = "avg" // FunctionLocalTimestamp identifies PostgreSQL's local timestamp constructor. FunctionLocalTimestamp Identifier = "localtimestamp" // FunctionLocalTime identifies PostgreSQL's local time constructor. FunctionLocalTime Identifier = "localtime" // FunctionCurrentTime identifies PostgreSQL's current zoned time value. FunctionCurrentTime Identifier = "current_time" // FunctionCurrentDate identifies PostgreSQL's current date value. FunctionCurrentDate Identifier = "current_date" // FunctionNow identifies PostgreSQL's current transaction timestamp function. FunctionNow Identifier = "now" // FunctionToLower identifies PostgreSQL's lowercase text function. FunctionToLower Identifier = "lower" // FunctionToUpper identifies PostgreSQL's uppercase text function. FunctionToUpper Identifier = "upper" // FunctionCoalesce identifies PostgreSQL's first-non-null expression. FunctionCoalesce Identifier = "coalesce" // FunctionNullIf identifies PostgreSQL's NULLIF function for nulling matching scalar values. FunctionNullIf Identifier = "nullif" // FunctionReplace identifies PostgreSQL's substring-replacement function. FunctionReplace Identifier = "replace" // FunctionUnnest identifies PostgreSQL's array-to-row expansion function. FunctionUnnest Identifier = "unnest" // FunctionNextValue identifies PostgreSQL's sequence increment function. FunctionNextValue Identifier = "nextval" // FunctionPGGetSerialSequence identifies PostgreSQL's serial-sequence lookup function. FunctionPGGetSerialSequence Identifier = "pg_get_serial_sequence" // FunctionJSONBSet identifies PostgreSQL's JSONB path-update function. FunctionJSONBSet Identifier = "jsonb_set" // FunctionCount identifies PostgreSQL's count aggregate. FunctionCount Identifier = "count" // FunctionStringToArray identifies PostgreSQL's delimiter-based text-to-array function. FunctionStringToArray Identifier = "string_to_array" // FunctionEdgesToPath identifies the SQL helper that builds a path from unordered edge composites. FunctionEdgesToPath Identifier = "edges_to_path" // FunctionOrderedEdgesToPath identifies the SQL helper that builds a path from ordered edge composites. FunctionOrderedEdgesToPath Identifier = "ordered_edges_to_path" // FunctionOrderedEdgeIDsToPath identifies the SQL helper that hydrates an ordered edge-ID array into a path. FunctionOrderedEdgeIDsToPath Identifier = "ordered_edge_ids_to_path" // FunctionNodesToPath identifies the SQL helper that builds a path from ordered node composites. FunctionNodesToPath Identifier = "nodes_to_path" // FunctionKindName identifies the SQL helper that resolves a kind ID to its name. FunctionKindName Identifier = "kind_name" // FunctionStartNode identifies the SQL helper that hydrates a relationship's start node. FunctionStartNode Identifier = "start_node" // FunctionEndNode identifies the SQL helper that hydrates a relationship's end node. FunctionEndNode Identifier = "end_node" // FunctionExtract identifies PostgreSQL's temporal component-extraction function. FunctionExtract Identifier = "extract" // FunctionGenerateSubscripts identifies PostgreSQL's array-index generation function. FunctionGenerateSubscripts Identifier = "generate_subscripts" FunctionCypherLikeEscape Identifier = "cypher_like_escape" )
const ( WildcardIdentifier Identifier = "*" EpochIdentifier Identifier = "epoch" )
const ( StringLiteralNull = "null" StringLiteralEmptyArray = "[]" TableNode Identifier = "node" TableEdge Identifier = "edge" TableKind Identifier = "kind" ColumnID Identifier = "id" ColumnName Identifier = "name" ColumnPath Identifier = "path" ColumnProperties Identifier = "properties" ColumnKindIDs Identifier = "kind_ids" ColumnKindID Identifier = "kind_id" ColumnGraphID Identifier = "graph_id" ColumnStartID Identifier = "start_id" ColumnEndID Identifier = "end_id" ColumnNodes Identifier = "nodes" ColumnEdges Identifier = "edges" )
func AsIdentifiers ¶
func AsIdentifiers(strs ...string) []Identifier
func (Identifier) AsCompoundIdentifier ¶
func (s Identifier) AsCompoundIdentifier() CompoundIdentifier
func (Identifier) AsExpression ¶
func (s Identifier) AsExpression() Expression
func (Identifier) AsSelectItem ¶
func (s Identifier) AsSelectItem() SelectItem
func (Identifier) Matches ¶
func (s Identifier) Matches(others ...Identifier) bool
func (Identifier) NodeType ¶
func (s Identifier) NodeType() string
func (Identifier) String ¶
func (s Identifier) String() string
type IdentifierSet ¶
type IdentifierSet struct {
// contains filtered or unexported fields
}
IdentifierSet represents a set of identifiers backed by a map[Identifier]struct{} instance.
func AllocateIdentifierSet ¶
func AllocateIdentifierSet(length int) *IdentifierSet
func AsIdentifierSet ¶
func AsIdentifierSet(identifiers ...Identifier) *IdentifierSet
func NewIdentifierSet ¶
func NewIdentifierSet() *IdentifierSet
func (*IdentifierSet) Add ¶
func (s *IdentifierSet) Add(identifiers ...Identifier) *IdentifierSet
func (*IdentifierSet) CheckedAdd ¶
func (s *IdentifierSet) CheckedAdd(identifier Identifier) bool
func (*IdentifierSet) Clear ¶
func (s *IdentifierSet) Clear()
func (*IdentifierSet) CombinedKey ¶
func (s *IdentifierSet) CombinedKey() Identifier
func (*IdentifierSet) Contains ¶
func (s *IdentifierSet) Contains(other Identifier) bool
func (*IdentifierSet) Copy ¶
func (s *IdentifierSet) Copy() *IdentifierSet
func (*IdentifierSet) IsEmpty ¶
func (s *IdentifierSet) IsEmpty() bool
func (*IdentifierSet) Len ¶
func (s *IdentifierSet) Len() int
func (*IdentifierSet) Matches ¶
func (s *IdentifierSet) Matches(other *IdentifierSet) bool
func (*IdentifierSet) MergeSet ¶
func (s *IdentifierSet) MergeSet(other *IdentifierSet) *IdentifierSet
func (*IdentifierSet) Remove ¶
func (s *IdentifierSet) Remove(others ...Identifier) *IdentifierSet
func (*IdentifierSet) RemoveSet ¶
func (s *IdentifierSet) RemoveSet(other *IdentifierSet) *IdentifierSet
func (*IdentifierSet) Satisfies ¶
func (s *IdentifierSet) Satisfies(other *IdentifierSet) bool
Satisfies returns true if the `other`is a subset of `s`
func (*IdentifierSet) Slice ¶
func (s *IdentifierSet) Slice() []Identifier
func (*IdentifierSet) Strings ¶
func (s *IdentifierSet) Strings() []string
type InExpression ¶
type InExpression struct {
Expression Expression
List []Expression
Negated bool
}
InExpression represents a contains operation against a list of evaluated expressions: m.identifier in (val1, val2, ...)
type InSubquery ¶
type InSubquery struct {
Expression Expression
Query Query
Negated bool
}
InSubquery represents a contains expression against a suq-query. [not] in (<Select> ...)
type Insert ¶
type Insert struct {
Table TableReference
Shape *RecordShape
OnConflict *OnConflict
Source *Query
Returning []SelectItem
}
Insert is a SQL statement that is evaluated to insert data into a target table.
func (Insert) AsExpression ¶ added in v0.5.0
func (s Insert) AsExpression() Expression
func (Insert) AsSetExpression ¶ added in v0.5.0
func (s Insert) AsSetExpression() SetExpression
func (Insert) AsStatement ¶
type Join ¶
type Join struct {
Table Expression
JoinOperator JoinOperator
}
type JoinOperator ¶
type JoinOperator struct {
JoinType JoinType
Constraint Expression
}
func (JoinOperator) NodeType ¶
func (s JoinOperator) NodeType() string
type JoinType ¶
type JoinType int
const ( // JoinTypeInner retains rows that satisfy the join constraint on both sides. JoinTypeInner JoinType = iota // JoinTypeLeftOuter retains every left row even when no right row matches. JoinTypeLeftOuter // JoinTypeRightOuter retains every right row even when no left row matches. JoinTypeRightOuter // JoinTypeFullOuter retains unmatched rows from both sides. JoinTypeFullOuter )
type KindListLiteral ¶
func (KindListLiteral) AsExpression ¶
func (s KindListLiteral) AsExpression() Expression
func (KindListLiteral) NodeType ¶
func (s KindListLiteral) NodeType() string
type KindMapper ¶
type KindMapper interface {
// MapKinds returns MissingKindsError for authoritative misses. Other errors
// remain execution failures, including when translating match predicates.
MapKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)
AssertKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)
}
KindMapper is an interface that represents a service that can map a given slice of graph.Kind to a slice of int16 numeric identifiers.
type LateralSubquery ¶ added in v0.5.0
type LateralSubquery struct {
Query Query
Binding models.Optional[Identifier]
}
func (LateralSubquery) AsExpression ¶ added in v0.5.0
func (s LateralSubquery) AsExpression() Expression
func (LateralSubquery) NodeType ¶ added in v0.5.0
func (s LateralSubquery) NodeType() string
type Literal ¶
Literal is a type-hinted literal SQL value.
func NewLiteral ¶
func NullLiteral ¶
func NullLiteral() Literal
func (Literal) AsExpression ¶
func (s Literal) AsExpression() Expression
func (Literal) AsSelectItem ¶
func (s Literal) AsSelectItem() SelectItem
type LiteralNodeValue ¶
type MatchedDelete ¶
type MatchedDelete struct {
Predicate Expression
}
func (MatchedDelete) AsExpression ¶
func (s MatchedDelete) AsExpression() Expression
func (MatchedDelete) AsMergeAction ¶
func (s MatchedDelete) AsMergeAction() MergeAction
func (MatchedDelete) NodeType ¶
func (s MatchedDelete) NodeType() string
type MatchedUpdate ¶
type MatchedUpdate struct {
Predicate Expression
Assignments []Assignment
}
func (MatchedUpdate) AsExpression ¶
func (s MatchedUpdate) AsExpression() Expression
func (MatchedUpdate) AsMergeAction ¶
func (s MatchedUpdate) AsMergeAction() MergeAction
func (MatchedUpdate) NodeType ¶
func (s MatchedUpdate) NodeType() string
type Materialized ¶
type Materialized struct {
Materialized bool
}
Materialized is an expression that represents a query hint for common table expressions that informs the query planner if it should prefer to materialize the given CTE.
func (Materialized) AsExpression ¶
func (s Materialized) AsExpression() Expression
func (Materialized) AsSetExpression ¶
func (s Materialized) AsSetExpression() SetExpression
func (Materialized) NodeType ¶
func (s Materialized) NodeType() string
type Merge ¶
type Merge struct {
Into bool
Table TableReference
Source TableReference
JoinTarget Expression
Actions []MergeAction
}
func (Merge) AsStatement ¶
type MergeAction ¶
type MergeAction interface {
Expression
AsMergeAction() MergeAction
}
MergeAction is an expression that can be used as the action of a merge statement.
type MissingKindsError ¶ added in v1.0.0
MissingKindsError reports an authoritative lookup miss after any cache refresh. KindIDs contains only the resolved kinds, in input order. Callers requiring all kinds must still treat this as an error; match translation can apply AND/OR semantics.
func (*MissingKindsError) Error ¶ added in v1.0.0
func (s *MissingKindsError) Error() string
type OnConflict ¶
type OnConflict struct {
Target *ConflictTarget
Action ConflictAction
}
OnConflict is an expression that outlines the target columns of a conflict and the action to be taken when a conflict is encountered.
func (OnConflict) AsExpression ¶
func (s OnConflict) AsExpression() Expression
func (OnConflict) NodeType ¶
func (s OnConflict) NodeType() string
type Operator ¶
type Operator string
const ( UnsetOperator Operator = "" OperatorUnion Operator = "union" OperatorConcatenate Operator = "||" OperatorArrayOverlap Operator = "&&" OperatorEquals Operator = "=" OperatorNotEquals Operator = "!=" OperatorGreaterThan Operator = ">" OperatorGreaterThanOrEqualTo Operator = ">=" OperatorLessThan Operator = "<" OperatorLessThanOrEqualTo Operator = "<=" OperatorLike Operator = "like" OperatorILike Operator = "ilike" OperatorPGArrayOverlap Operator = "operator (pg_catalog.&&)" OperatorPGArrayLHSContainsRHS Operator = "operator (pg_catalog.@>)" OperatorAnd Operator = "and" OperatorOr Operator = "or" OperatorNot Operator = "not" OperatorJSONBFieldExists Operator = "?" OperatorJSONField Operator = "->" OperatorJSONTextField Operator = "->>" OperatorAdd Operator = "+" OperatorSubtract Operator = "-" OperatorMultiply Operator = "*" OperatorDivide Operator = "/" OperatorIn Operator = "in" OperatorIs Operator = "is" OperatorIsNot Operator = "is not" OperatorSimilarTo Operator = "similar to" OperatorRegexMatch Operator = "~" OperatorAssignment Operator = "=" OperatorAdditionAssignment Operator = "+=" OperatorIsDistinctFrom Operator = "is distinct from" OperatorIsNotDistinctFrom Operator = "is not distinct from" OperatorCypherRegexMatch Operator = "=~" OperatorCypherStartsWith Operator = "starts with" OperatorCypherContains Operator = "contains" OperatorCypherEndsWith Operator = "ends with" OperatorCypherNotEquals Operator = "<>" OperatorPropertyLookup Operator = "property_lookup" OperatorKindAssignment Operator = "kind_assignment" )
func (Operator) AsExpression ¶
func (s Operator) AsExpression() Expression
type OrderBy ¶
type OrderBy struct {
Expression Expression
Ascending bool
}
func NewOrderBy ¶
func (OrderBy) AsExpression ¶
func (s OrderBy) AsExpression() Expression
type Parameter ¶
type Parameter struct {
Identifier Identifier
CastType DataType
}
func AsParameter ¶
func AsParameter(identifier Identifier, value any) (*Parameter, error)
func (Parameter) AsExpression ¶
func (s Parameter) AsExpression() Expression
func (Parameter) AsSelectItem ¶
func (s Parameter) AsSelectItem() SelectItem
type Parenthetical ¶
type Parenthetical struct {
Expression Expression
}
(<expr>)
func NewParenthetical ¶
func NewParenthetical(expr Expression) *Parenthetical
func (*Parenthetical) AsExpression ¶
func (s *Parenthetical) AsExpression() Expression
func (*Parenthetical) AsSelectItem ¶
func (s *Parenthetical) AsSelectItem() SelectItem
func (*Parenthetical) NodeType ¶
func (s *Parenthetical) NodeType() string
type Projection ¶
type Projection []SelectItem
Projection is an alias for a slice of SelectItem instances.
func (Projection) AsExpression ¶
func (s Projection) AsExpression() Expression
func (Projection) AsSyntaxNodes ¶
func (s Projection) AsSyntaxNodes() []SyntaxNode
func (Projection) NodeType ¶
func (s Projection) NodeType() string
type ProjectionFrom ¶
type ProjectionFrom struct {
Projection Projection
From []FromClause
}
func (ProjectionFrom) AsExpression ¶
func (s ProjectionFrom) AsExpression() Expression
func (ProjectionFrom) NodeType ¶
func (s ProjectionFrom) NodeType() string
type PropertyKey ¶ added in v0.9.0
type PropertyKey struct {
Literal Literal
}
func (PropertyKey) AsExpression ¶ added in v0.9.0
func (s PropertyKey) AsExpression() Expression
func (PropertyKey) NodeType ¶ added in v0.9.0
func (s PropertyKey) NodeType() string
type Query ¶
type Query struct {
CommonTableExpressions *With
Body SetExpression
OrderBy []*OrderBy
Offset Expression
Limit Expression
}
[with <CTE>] select * from table;
func (Query) AddCTE ¶
func (s Query) AddCTE(cte CommonTableExpression)
func (Query) AsExpression ¶
func (s Query) AsExpression() Expression
func (Query) AsSetExpression ¶
func (s Query) AsSetExpression() SetExpression
func (Query) AsStatement ¶
type RecordShape ¶
type RecordShape struct {
Columns []Identifier
}
RecordShape defines a list of column identifiers that name a record's fields: (id, enrolled)
func NewRecordShape ¶ added in v0.2.1
func NewRecordShape(columns []Identifier) *RecordShape
func (RecordShape) NodeType ¶
func (s RecordShape) NodeType() string
type RowColumnReference ¶
type RowColumnReference struct {
Identifier Expression
Column Identifier
}
func (RowColumnReference) AsExpression ¶
func (s RowColumnReference) AsExpression() Expression
func (RowColumnReference) AsSelectItem ¶
func (s RowColumnReference) AsSelectItem() SelectItem
func (RowColumnReference) NodeType ¶
func (s RowColumnReference) NodeType() string
type Select ¶
type Select struct {
Distinct bool
Projection Projection
From []FromClause
Where Expression
GroupBy []Expression
Having Expression
}
Select is a SQL expression that is evaluated to fetch data.
func (Select) AsExpression ¶
func (s Select) AsExpression() Expression
func (Select) AsSetExpression ¶
func (s Select) AsSetExpression() SetExpression
type SelectItem ¶
type SelectItem interface {
Expression
AsSelectItem() SelectItem
}
SelectItem is an expression that can be used as a projection.
type SetExpression ¶
type SetExpression interface {
Expression
AsSetExpression() SetExpression
}
SetExpression is an expression that represents a query body expression.
type SetOperation ¶
type SetOperation struct {
Operator Operator
LOperand SetExpression
ROperand SetExpression
All bool
Distinct bool
}
SetOperation is a binary expression that represents an operation to be applied to two set expressions:
select 1 union select 2;
func (SetOperation) AsExpression ¶
func (s SetOperation) AsExpression() Expression
func (SetOperation) AsSetExpression ¶
func (s SetOperation) AsSetExpression() SetExpression
func (SetOperation) NodeType ¶
func (s SetOperation) NodeType() string
type Statement ¶
type Statement interface {
SyntaxNode
AsStatement() Statement
}
Statement is a syntax node that does not evaluate to a value.
type Subquery ¶
type Subquery struct {
Query Query
}
func (Subquery) AsExpression ¶
func (s Subquery) AsExpression() Expression
type SymbolTable ¶
type SymbolTable struct {
// contains filtered or unexported fields
}
SymbolTable is a symbol table that has some generic functions for negotiating unique symbols from identifiers, compound identifiers, and other PgSQL AST elements.
func NewSymbolTable ¶
func NewSymbolTable() *SymbolTable
func (*SymbolTable) Add ¶
func (s *SymbolTable) Add(symbol any)
func (*SymbolTable) AddCompoundIdentifier ¶
func (s *SymbolTable) AddCompoundIdentifier(identifier CompoundIdentifier)
func (*SymbolTable) AddIdentifier ¶
func (s *SymbolTable) AddIdentifier(identifier Identifier)
func (*SymbolTable) AddTable ¶
func (s *SymbolTable) AddTable(symbols *SymbolTable)
func (*SymbolTable) Contains ¶
func (s *SymbolTable) Contains(symbol any) bool
func (*SymbolTable) EachCompoundIdentifier ¶
func (s *SymbolTable) EachCompoundIdentifier(each func(next CompoundIdentifier) bool)
func (*SymbolTable) EachIdentifier ¶
func (s *SymbolTable) EachIdentifier(each func(next Identifier) bool)
func (*SymbolTable) IsEmpty ¶
func (s *SymbolTable) IsEmpty() bool
func (*SymbolTable) NotIn ¶
func (s *SymbolTable) NotIn(exclusions *SymbolTable) *SymbolTable
func (*SymbolTable) RootIdentifiers ¶
func (s *SymbolTable) RootIdentifiers() *IdentifierSet
type SyntaxNode ¶
type SyntaxNode interface {
NodeType() string
}
SyntaxNode is the top-level interface for any of the modeled PgSQL AST syntax elements.
type SyntaxNodeFuture ¶
type SyntaxNodeFuture interface {
SyntaxNode
Unwrap() SyntaxNode
Satisfied() bool
}
SyntaxNodeFuture is a SyntaxNode that can be satisfied out-of-tree and communicate if it has been satisfied to upstream consumers. This is useful when a SyntaxNode is required to be embedded in a built syntax tree but can not be formally built itself due to ordering or missing dependency information (in the case of an existential subquery).
type TableAlias ¶
type TableAlias struct {
Name Identifier
Shape *RecordShape
}
TableAlias is an alias for a table with an optional record shape.
func (TableAlias) NodeType ¶
func (s TableAlias) NodeType() string
type TableReference ¶
type TableReference struct {
Name CompoundIdentifier
Binding models.Optional[Identifier]
}
func (TableReference) AsExpression ¶
func (s TableReference) AsExpression() Expression
func (TableReference) NodeType ¶
func (s TableReference) NodeType() string
type TypeCast ¶
type TypeCast struct {
Expression Expression
CastType DataType
}
TypeCast wraps a given expression in a type cast that matches the given DataType.
func (TypeCast) AsExpression ¶
func (s TypeCast) AsExpression() Expression
func (TypeCast) AsSelectItem ¶ added in v0.5.0
func (s TypeCast) AsSelectItem() SelectItem
type TypeHinted ¶
type TypeHinted interface {
Expression
TypeHint() DataType
}
TypeHinted is an expression that contains a DataType hint that can be accessed by handlers.
func NewTypeCast ¶
func NewTypeCast(expression Expression, dataType DataType) TypeHinted
type UnaryExpression ¶
type UnaryExpression struct {
Operator Expression
Operand Expression
}
not <expr>
func NewUnaryExpression ¶
func NewUnaryExpression(operator Operator, operand Expression) *UnaryExpression
func (UnaryExpression) AsExpression ¶
func (s UnaryExpression) AsExpression() Expression
func (UnaryExpression) AsSelectItem ¶ added in v1.0.0
func (s UnaryExpression) AsSelectItem() SelectItem
func (UnaryExpression) NodeType ¶
func (s UnaryExpression) NodeType() string
type UnmatchedAction ¶
type UnmatchedAction struct {
Predicate Expression
Columns []Identifier
Values Values
}
func (UnmatchedAction) AsExpression ¶
func (s UnmatchedAction) AsExpression() Expression
func (UnmatchedAction) AsMergeAction ¶
func (s UnmatchedAction) AsMergeAction() MergeAction
func (UnmatchedAction) NodeType ¶
func (s UnmatchedAction) NodeType() string
type Update ¶
type Update struct {
Table TableReference
Assignments []Assignment
From []FromClause
Where Expression
Returning []SelectItem
}
Update is a SQL statement that is evaluated to update data in a target table.
func (Update) AsExpression ¶
func (s Update) AsExpression() Expression
func (Update) AsSetExpression ¶
func (s Update) AsSetExpression() SetExpression
func (Update) AsStatement ¶
type Values ¶
type Values struct {
Values []Expression
}
Values represents a list of expressions to be taken as a value array: insert into table (id, enrolled) values (1, true);
func (Values) AsExpression ¶
func (s Values) AsExpression() Expression
func (Values) AsSetExpression ¶
func (s Values) AsSetExpression() SetExpression
type Variadic ¶
type Variadic struct {
Expression Expression
}
Variadic isrepresents a variadic expansion of the given expression.
func (Variadic) AsExpression ¶
func (s Variadic) AsExpression() Expression
type Wildcard ¶
type Wildcard struct{}
func (Wildcard) AsExpression ¶
func (s Wildcard) AsExpression() Expression
func (Wildcard) AsSelectItem ¶
func (s Wildcard) AsSelectItem() SelectItem
type Window ¶
type Window struct {
PartitionBy []Expression
OrderBy []OrderBy
WindowFrame *WindowFrame
}
type WindowFrame ¶
type WindowFrame struct {
Unit WindowFrameUnit
StartBoundary WindowFrameBoundary
EndBoundary *WindowFrameBoundary
}
type WindowFrameBoundary ¶
type WindowFrameBoundary struct {
BoundaryType WindowFrameBoundaryType
BoundaryLiteral *Literal
}
type WindowFrameBoundaryType ¶
type WindowFrameBoundaryType int
const ( // WindowFrameBoundaryTypeCurrentRow anchors a window boundary at the current row or peer group. WindowFrameBoundaryTypeCurrentRow WindowFrameBoundaryType = iota // WindowFrameBoundaryTypePreceding places a window boundary before the current row. WindowFrameBoundaryTypePreceding // WindowFrameBoundaryTypeFollowing places a window boundary after the current row. WindowFrameBoundaryTypeFollowing )
type WindowFrameUnit ¶
type WindowFrameUnit int
const ( // WindowFrameUnitRows measures frame boundaries in physical rows. WindowFrameUnitRows WindowFrameUnit = iota // WindowFrameUnitRange measures frame boundaries by ordering-key value ranges. WindowFrameUnitRange // WindowFrameUnitGroups measures frame boundaries in peer groups. WindowFrameUnitGroups )
type With ¶
type With struct {
Recursive bool
Expressions []CommonTableExpression
}
With is a statement that provides a way to write auxiliary statements for use in a larger query.
type WrappedNode ¶
type WrappedNode interface {
SyntaxNode
}
WrappedNode is an interface that allows for an expression to be wrapped to allow for side effects like futures.