Documentation
¶
Overview ¶
Package ast provides AST nodes definitions.
The definitions of ASTs are based on the following document.
- https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language
- https://cloud.google.com/spanner/docs/query-syntax
Each Node's documentation describes its syntax (SQL representation) in a text/template fashion with thw following custom functions.
- sql node: Returns the SQL representation of node.
- sqlOpt node: Like sql node, but returns the empty string if node is nil.
- sqlJoin sep nodes: Concatenates the SQL representations of nodes with sep.
- sqlIdentQuote x: Quotes the given identifier string if needed.
- sqlStringQuote s: Returns the SQL quoted string of s.
- sqlBytesQuote bs: Returns the SQL quotes bytes of bs.
- tokenJoin toks: Concateates the string representations of tokens.
- isnil v: Checks whether v is nil or others.
Each Node's documentation has pos and end information using the following EBNF.
PosChoice -> PosExpr ("||" PosExpr)* PosExpr -> PosAtom ("+" IntAtom)* PosAtom -> PosVar | NodeExpr "." ("pos" | "end") NodeExpr -> NodeAtom | "(" NodeAtom ("??" NodeAtom)* ")" NodeAtom -> NodeVar | NodeSliceVar "[" (IntAtom | "$") "]" IntAtom -> IntVal | "len" "(" StringVar ")" | "(" BoolVar "?" IntAtom ":" IntAtom ")" IntVal -> "0" | "1" | ... (PosVar, NodeVar, NodeSliceVar, and BoolVar are derived by its struct definition.)
Index ¶
- Variables
- func Inspect(node Node, f func(Node) bool)
- func InspectMany[T Node](nodes []T, f func(Node) bool)
- func Preorder(node Node) iter.Seq[Node]
- func PreorderMany[T Node](nodes []T) iter.Seq[Node]
- func Walk(node Node, v Visitor)
- func WalkMany[T Node](nodes []T, v Visitor)
- type AddColumn
- type AddRowDeletionPolicy
- type AddStoredColumn
- type AddSynonym
- type AddTableConstraint
- type Alias
- type AllOrDistinct
- type AlterChangeStream
- type AlterColumn
- type AlterColumnAlterIdentity
- type AlterColumnDropDefault
- type AlterColumnSetDefault
- type AlterColumnSetOptions
- type AlterColumnType
- type AlterDatabase
- type AlterIndex
- type AlterModel
- type AlterProtoBundle
- type AlterProtoBundleDelete
- type AlterProtoBundleInsert
- type AlterProtoBundleUpdate
- type AlterSearchIndex
- type AlterSequence
- type AlterStatistics
- type AlterTable
- type Analyze
- type Arg
- type ArrayLiteral
- type ArraySchemaType
- type ArraySubQuery
- type ArrayType
- type AsAlias
- type AsStruct
- type AsTypeName
- type AsValue
- type AtTimeZone
- type AutoIncrement
- type BadDDL
- type BadDML
- type BadExpr
- type BadNode
- type BadQueryExpr
- type BadStatement
- type BadType
- type BetweenExpr
- type BinaryExpr
- type BinaryOp
- type BitReversedPositive
- type BoolLiteral
- type BracedConstructor
- type BracedConstructorField
- type BracedConstructorFieldValue
- type BracedConstructorFieldValueExpr
- type BracedNewConstructor
- type BytesLiteral
- type CTE
- type Call
- type CallExpr
- type CaseElse
- type CaseExpr
- type CaseWhen
- type CastExpr
- type CastIntValue
- type CastNumValue
- type ChangeStreamAlteration
- type ChangeStreamDropForAll
- type ChangeStreamFor
- type ChangeStreamForAll
- type ChangeStreamForTable
- type ChangeStreamForTables
- type ChangeStreamSetFor
- type ChangeStreamSetOptions
- type Check
- type Cluster
- type Collate
- type ColumnAlteration
- type ColumnDef
- type ColumnDefaultExpr
- type ColumnDefaultSemantics
- type CompoundQuery
- type Constraint
- type CountStarExpr
- type CreateChangeStream
- type CreateDatabase
- type CreateIndex
- type CreateModel
- type CreateModelColumn
- type CreateModelInputOutput
- type CreatePlacement
- type CreatePropertyGraph
- type CreateProtoBundle
- type CreateRole
- type CreateRowDeletionPolicy
- type CreateSchema
- type CreateSearchIndex
- type CreateSequence
- type CreateTable
- type CreateVectorIndex
- type CreateView
- type DDL
- type DML
- type DateLiteral
- type DefaultExpr
- type Delete
- type DeletePrivilege
- type Direction
- type DotStar
- type DropChangeStream
- type DropColumn
- type DropConstraint
- type DropIndex
- type DropModel
- type DropPropertyGraph
- type DropProtoBundle
- type DropRole
- type DropRowDeletionPolicy
- type DropSchema
- type DropSearchIndex
- type DropSequence
- type DropStoredColumn
- type DropSynonym
- type DropTable
- type DropVectorIndex
- type DropView
- type ExecutePrivilegeOnTableFunction
- type ExistsSubQuery
- type Expr
- type ExprArg
- type ExprSelectItem
- type ExtractExpr
- type FloatLiteral
- type ForUpdate
- type ForeignKey
- type From
- type FromQuery
- type GeneratedColumnExpr
- type Grant
- type GroupBy
- type Having
- type HavingMax
- type HavingMin
- type HavingModifier
- type Hint
- type HintRecord
- type Ident
- type IdentityAlteration
- type IdentityColumn
- type IfExpr
- type IgnoreNulls
- type InCondition
- type InExpr
- type IndexAlteration
- type IndexExpr
- type IndexKey
- type Insert
- type InsertInput
- type InsertOrType
- type InsertPrivilege
- type IntLiteral
- type IntValue
- type InterleaveIn
- type IntervalArg
- type IsBoolExpr
- type IsNullExpr
- type JSONLiteral
- type Join
- type JoinCondition
- type JoinMethod
- type JoinOp
- type LambdaArg
- type Limit
- type ModelArg
- type NamedArg
- type NamedType
- type NewConstructor
- type NewConstructorArg
- type NoSkipRange
- type Node
- type NullHandlingModifier
- type NullLiteral
- type NumValue
- type NumericLiteral
- type Offset
- type On
- type OnDeleteAction
- type Options
- func (o *Options) BoolField(name string) (*bool, error)
- func (o *Options) End() token.Pos
- func (o *Options) Field(name string) (expr Expr, found bool)
- func (o *Options) IntegerField(name string) (*int64, error)
- func (o *Options) Pos() token.Pos
- func (g *Options) SQL() string
- func (o *Options) StringField(name string) (*string, error)
- type OptionsDef
- type OrderBy
- type OrderByItem
- type Param
- type ParenExpr
- type ParenTableExpr
- type Path
- type PathTableExpr
- type PipeOperator
- type PipeSelect
- type PipeWhere
- type PositionKeyword
- type Privilege
- type PrivilegeOnTable
- type PropertyGraphColumnNameList
- type PropertyGraphContent
- type PropertyGraphDerivedProperty
- type PropertyGraphDerivedPropertyList
- type PropertyGraphDestinationKey
- type PropertyGraphEdgeElementKeys
- type PropertyGraphEdgeTables
- type PropertyGraphElement
- type PropertyGraphElementKey
- type PropertyGraphElementKeys
- type PropertyGraphElementLabel
- type PropertyGraphElementLabelDefaultLabel
- type PropertyGraphElementLabelLabelName
- type PropertyGraphElementList
- type PropertyGraphElementProperties
- type PropertyGraphLabelAndProperties
- type PropertyGraphLabelAndPropertiesList
- type PropertyGraphLabelsOrProperties
- type PropertyGraphNoProperties
- type PropertyGraphNodeElementKey
- type PropertyGraphNodeTables
- type PropertyGraphPropertiesAre
- type PropertyGraphSingleProperties
- type PropertyGraphSourceKey
- type ProtoBundleTypes
- type Query
- type QueryExpr
- type QueryStatement
- type RenameTable
- type RenameTableTo
- type RenameTo
- type ReplaceFieldsArg
- type ReplaceFieldsExpr
- type ReplaceRowDeletionPolicy
- type RespectNulls
- type RestartCounterWith
- type Revoke
- type RolePrivilege
- type RowDeletionPolicy
- type ScalarSchemaType
- type ScalarSubQuery
- type ScalarTypeName
- type SchemaType
- type SecurityType
- type Select
- type SelectAs
- type SelectItem
- type SelectPrivilege
- type SelectPrivilegeOnChangeStream
- type SelectPrivilegeOnView
- type SelectorExpr
- type SequenceArg
- type SequenceParam
- type SetNoSkipRange
- type SetOnDelete
- type SetOp
- type SetSkipRange
- type SimpleType
- type SizedSchemaType
- type SkipRange
- type Star
- type StarModifierExcept
- type StarModifierReplace
- type StarModifierReplaceItem
- type StartCounterWith
- type Statement
- type Storing
- type StringLiteral
- type StringValue
- type StructField
- type StructType
- type SubQuery
- type SubQueryInCondition
- type SubQueryInput
- type SubQueryTableExpr
- type SubscriptSpecifier
- type SubscriptSpecifierKeyword
- type Synonym
- type TVFArg
- type TVFCallExpr
- type TableAlteration
- type TableArg
- type TableConstraint
- type TableExpr
- type TableName
- type TablePrivilege
- type TableSample
- type TableSampleMethod
- type TableSampleSize
- type TableSampleUnit
- type ThenReturn
- type TimestampLiteral
- type TupleStructLiteral
- type Type
- type TypedStructLiteral
- type TypelessStructLiteral
- type TypelessStructLiteralArg
- type UnaryExpr
- type UnaryOp
- type Unnest
- type UnnestInCondition
- type Update
- type UpdateItem
- type UpdatePrivilege
- type Using
- type ValuesInCondition
- type ValuesInput
- type ValuesRow
- type Visitor
- type Where
- type With
- type WithAction
- type WithExpr
- type WithExprVar
- type WithOffset
Constants ¶
This section is empty.
Variables ¶
var ErrFieldNotFound = errors.New("field not found")
FieldNotFound is returned Options.*Field methods. It can be handled as a non-error.
Functions ¶
func Inspect ¶ added in v0.3.0
Inspect traverses an AST node in depth-first order and calls f for each node.
func InspectMany ¶ added in v0.3.0
InspectMany traverses AST nodes in depth-first order and calls f for each node.
func Preorder ¶ added in v0.3.0
Preorder returns an iterator that traverses an AST in depth-first preorder.
func PreorderMany ¶ added in v0.3.0
PreorderMany returns an iterator that traverses AST nodes in depth-first preorder.
Types ¶
type AddColumn ¶
type AddColumn struct { Add token.Pos // position of "ADD" keyword IfNotExists bool Column *ColumnDef }
AddColumn is ADD COLUMN clause in ALTER TABLE.
ADD COLUMN {{if .IfNotExists}}IF NOT EXISTS{{end}} {{.Column | sql}}
type AddRowDeletionPolicy ¶
type AddRowDeletionPolicy struct { Add token.Pos // position of "ADD" keyword RowDeletionPolicy *RowDeletionPolicy }
AddRowDeletionPolicy is ADD ROW DELETION POLICY clause in ALTER TABLE.
ADD {{.RowDeletionPolicy | sql}}
func (*AddRowDeletionPolicy) End ¶
func (a *AddRowDeletionPolicy) End() token.Pos
func (*AddRowDeletionPolicy) Pos ¶
func (a *AddRowDeletionPolicy) Pos() token.Pos
func (*AddRowDeletionPolicy) SQL ¶
func (a *AddRowDeletionPolicy) SQL() string
type AddStoredColumn ¶
AddStoredColumn is ADD STORED COLUMN clause in ALTER INDEX.
ADD STORED COLUMN {{.Name | sql}}
func (*AddStoredColumn) End ¶
func (a *AddStoredColumn) End() token.Pos
func (*AddStoredColumn) Pos ¶
func (a *AddStoredColumn) Pos() token.Pos
func (*AddStoredColumn) SQL ¶
func (a *AddStoredColumn) SQL() string
type AddSynonym ¶
AddSynonym is ADD SYNONYM node in ALTER TABLE.
ADD SYNONYM {{.Name | sql}}
func (*AddSynonym) End ¶
func (a *AddSynonym) End() token.Pos
func (*AddSynonym) Pos ¶
func (a *AddSynonym) Pos() token.Pos
func (*AddSynonym) SQL ¶
func (s *AddSynonym) SQL() string
type AddTableConstraint ¶
type AddTableConstraint struct { Add token.Pos // position of "ADD" keyword TableConstraint *TableConstraint }
AddTableConstraint is ADD table_constraint clause in ALTER TABLE.
ADD {{.TableConstraint}}
func (*AddTableConstraint) End ¶
func (a *AddTableConstraint) End() token.Pos
func (*AddTableConstraint) Pos ¶
func (a *AddTableConstraint) Pos() token.Pos
func (*AddTableConstraint) SQL ¶
func (a *AddTableConstraint) SQL() string
type Alias ¶
Alias is aliased expression by AS clause.
Typically, this appears in SELECT result columns list, but this can appear in typeless STRUCT literals and NEW constructors.
{{.Expr | sql}} {{.As | sql}}
type AllOrDistinct ¶
type AllOrDistinct string
AllOrDistinct represents ALL or DISTINCT in SELECT or set operations, etc. If it is optional, it may be an empty string, so handle it according to the context.
const ( AllOrDistinctAll AllOrDistinct = "ALL" AllOrDistinctDistinct AllOrDistinct = "DISTINCT" )
type AlterChangeStream ¶
type AlterChangeStream struct { Alter token.Pos // position of "ALTER" keyword Name *Ident ChangeStreamAlteration ChangeStreamAlteration }
AlterChangeStream is ALTER CHANGE STREAM statement node.
ALTER CHANGE STREAM {{.Name | sql}} {{.ChangeStreamAlteration | sql}}
func (*AlterChangeStream) End ¶
func (a *AlterChangeStream) End() token.Pos
func (*AlterChangeStream) Pos ¶
func (a *AlterChangeStream) Pos() token.Pos
func (*AlterChangeStream) SQL ¶
func (a *AlterChangeStream) SQL() string
type AlterColumn ¶
type AlterColumn struct { Alter token.Pos // position of "ALTER" keyword Name *Ident Alteration ColumnAlteration }
AlterColumn is ALTER COLUMN clause in ALTER TABLE.
ALTER COLUMN {{.Name | sql}} {{.Alteration | sql}}
func (*AlterColumn) End ¶
func (a *AlterColumn) End() token.Pos
func (*AlterColumn) Pos ¶
func (a *AlterColumn) Pos() token.Pos
func (*AlterColumn) SQL ¶
func (a *AlterColumn) SQL() string
type AlterColumnAlterIdentity ¶
type AlterColumnAlterIdentity struct { Alter token.Pos Alteration IdentityAlteration }
AlterColumnAlterIdentity is ALTER IDENTITY node in ALTER COLUMN
ALTER IDENTITY {{.Alteration | sql}}
func (*AlterColumnAlterIdentity) End ¶
func (a *AlterColumnAlterIdentity) End() token.Pos
func (*AlterColumnAlterIdentity) Pos ¶
func (a *AlterColumnAlterIdentity) Pos() token.Pos
func (*AlterColumnAlterIdentity) SQL ¶
func (a *AlterColumnAlterIdentity) SQL() string
type AlterColumnDropDefault ¶
AlterColumnDropDefault is DROP DEFAULT node in ALTER COLUMN
DROP DEFAULT
func (*AlterColumnDropDefault) End ¶
func (a *AlterColumnDropDefault) End() token.Pos
func (*AlterColumnDropDefault) Pos ¶
func (a *AlterColumnDropDefault) Pos() token.Pos
func (*AlterColumnDropDefault) SQL ¶
func (a *AlterColumnDropDefault) SQL() string
type AlterColumnSetDefault ¶
type AlterColumnSetDefault struct { Set token.Pos DefaultExpr *ColumnDefaultExpr }
AlterColumnSetDefault is SET DEFAULT node in ALTER COLUMN.
SET {{.DefaultExpr | sql}}
func (*AlterColumnSetDefault) End ¶
func (a *AlterColumnSetDefault) End() token.Pos
func (*AlterColumnSetDefault) Pos ¶
func (a *AlterColumnSetDefault) Pos() token.Pos
func (*AlterColumnSetDefault) SQL ¶
func (a *AlterColumnSetDefault) SQL() string
type AlterColumnSetOptions ¶
AlterColumnSetOptions is SET OPTIONS node in ALTER COLUMN.
SET {{.Options | sql}}
func (*AlterColumnSetOptions) End ¶
func (a *AlterColumnSetOptions) End() token.Pos
func (*AlterColumnSetOptions) Pos ¶
func (a *AlterColumnSetOptions) Pos() token.Pos
func (*AlterColumnSetOptions) SQL ¶
func (a *AlterColumnSetOptions) SQL() string
type AlterColumnType ¶
type AlterColumnType struct { Type SchemaType Null token.Pos // position of "NULL" keyword, optional NotNull bool DefaultExpr *ColumnDefaultExpr // optional }
AlterColumnType is action to change the data type of the column in ALTER COLUMN.
{{.Type | sql}} {{if .NotNull}}NOT NULL{{end}} {{.DefaultExpr | sqlOpt}}
func (*AlterColumnType) End ¶
func (a *AlterColumnType) End() token.Pos
func (*AlterColumnType) Pos ¶
func (a *AlterColumnType) Pos() token.Pos
func (*AlterColumnType) SQL ¶
func (a *AlterColumnType) SQL() string
type AlterDatabase ¶
type AlterDatabase struct { Alter token.Pos // position of "ALTER" keyword Name *Ident Options *Options }
AlterDatabase is ALTER DATABASE statement node.
ALTER DATABASE {{.Name | sql}} SET {{.Options | sql}}
func (*AlterDatabase) End ¶
func (a *AlterDatabase) End() token.Pos
func (*AlterDatabase) Pos ¶
func (a *AlterDatabase) Pos() token.Pos
func (*AlterDatabase) SQL ¶
func (d *AlterDatabase) SQL() string
type AlterIndex ¶
type AlterIndex struct { Alter token.Pos // position of "ALTER" keyword Name *Path IndexAlteration IndexAlteration }
AlterIndex is ALTER INDEX statement node.
ALTER INDEX {{.Name | sql}} {{.IndexAlteration | sql}}
func (*AlterIndex) End ¶
func (a *AlterIndex) End() token.Pos
func (*AlterIndex) Pos ¶
func (a *AlterIndex) Pos() token.Pos
func (*AlterIndex) SQL ¶
func (a *AlterIndex) SQL() string
type AlterModel ¶
AlterModel is ALTER MODEL statement node.
ALTER MODEL {{if .IfExists}}IF EXISTS{{end}} {{.Name | sql}} SET {{.Options | sql}}
func (*AlterModel) End ¶
func (a *AlterModel) End() token.Pos
func (*AlterModel) Pos ¶
func (a *AlterModel) Pos() token.Pos
func (*AlterModel) SQL ¶
func (a *AlterModel) SQL() string
type AlterProtoBundle ¶
type AlterProtoBundle struct { Alter token.Pos // position of "ALTER" keyword Bundle token.Pos Insert *AlterProtoBundleInsert // optional Update *AlterProtoBundleUpdate // optional Delete *AlterProtoBundleDelete // optional }
AlterProtoBundle is ALTER PROTO BUNDLE statement node.
ALTER PROTO BUNDLE {{.Insert | sqlOpt}} {{.Update | sqlOpt}} {{.Delete | sqlOpt}}
func (*AlterProtoBundle) End ¶
func (a *AlterProtoBundle) End() token.Pos
func (*AlterProtoBundle) Pos ¶
func (a *AlterProtoBundle) Pos() token.Pos
func (*AlterProtoBundle) SQL ¶
func (a *AlterProtoBundle) SQL() string
type AlterProtoBundleDelete ¶
type AlterProtoBundleDelete struct { Delete token.Pos // position of "DELETE" pseudo keyword Types *ProtoBundleTypes }
AlterProtoBundleDelete is DELETE (proto_type_name, ...) node in ALTER PROTO BUNDLE.
DELETE {{.Types | sql}}
func (*AlterProtoBundleDelete) End ¶
func (a *AlterProtoBundleDelete) End() token.Pos
func (*AlterProtoBundleDelete) Pos ¶
func (a *AlterProtoBundleDelete) Pos() token.Pos
func (*AlterProtoBundleDelete) SQL ¶
func (a *AlterProtoBundleDelete) SQL() string
type AlterProtoBundleInsert ¶
type AlterProtoBundleInsert struct { Insert token.Pos // position of "INSERT" pseudo keyword Types *ProtoBundleTypes }
AlterProtoBundleInsert is INSERT (proto_type_name, ...) node in ALTER PROTO BUNDLE.
INSERT {{.Types | sql}}
func (*AlterProtoBundleInsert) End ¶
func (a *AlterProtoBundleInsert) End() token.Pos
func (*AlterProtoBundleInsert) Pos ¶
func (a *AlterProtoBundleInsert) Pos() token.Pos
func (*AlterProtoBundleInsert) SQL ¶
func (a *AlterProtoBundleInsert) SQL() string
type AlterProtoBundleUpdate ¶
type AlterProtoBundleUpdate struct { Update token.Pos // position of "UPDATE" pseudo keyword Types *ProtoBundleTypes }
AlterProtoBundleUpdate is UPDATE (proto_type_name, ...) node in ALTER PROTO BUNDLE.
UPDATE {{.Types | sql}}
func (*AlterProtoBundleUpdate) End ¶
func (a *AlterProtoBundleUpdate) End() token.Pos
func (*AlterProtoBundleUpdate) Pos ¶
func (a *AlterProtoBundleUpdate) Pos() token.Pos
func (*AlterProtoBundleUpdate) SQL ¶
func (a *AlterProtoBundleUpdate) SQL() string
type AlterSearchIndex ¶
type AlterSearchIndex struct { Alter token.Pos Name *Ident IndexAlteration IndexAlteration }
AlterSearchIndex represents ALTER SEARCH INDEX statement.
ALTER SEARCH INDEX {{.Name | sql}} {{.IndexAlteration | sql}}
func (*AlterSearchIndex) End ¶
func (a *AlterSearchIndex) End() token.Pos
func (*AlterSearchIndex) Pos ¶
func (a *AlterSearchIndex) Pos() token.Pos
func (*AlterSearchIndex) SQL ¶
func (a *AlterSearchIndex) SQL() string
type AlterSequence ¶
type AlterSequence struct { Alter token.Pos // position of "ALTER" keyword Name *Path Options *Options // optional RestartCounterWith *RestartCounterWith // optional SkipRange *SkipRange // optional NoSkipRange *NoSkipRange // optional }
AlterSequence is ALTER SEQUENCE statement node.
ALTER SEQUENCE {{.Name | sql}} {{if .Options}}SET {{.Options | sqlOpt}}{{end}} {{.RestartCounterWith | sqlOpt}} {{.SkipRange | sqlOpt}} {{.NoSkipRange | sqlOpt}}
func (*AlterSequence) End ¶
func (a *AlterSequence) End() token.Pos
func (*AlterSequence) Pos ¶
func (a *AlterSequence) Pos() token.Pos
func (*AlterSequence) SQL ¶
func (c *AlterSequence) SQL() string
type AlterStatistics ¶
type AlterStatistics struct { Alter token.Pos // position of "ALTER" keyword Name *Ident Options *Options }
AlterStatistics is ALTER STATISTICS statement node.
ALTER STATISTICS {{.Name | sql}} SET {{.Options | sql}}
func (*AlterStatistics) End ¶
func (a *AlterStatistics) End() token.Pos
func (*AlterStatistics) Pos ¶
func (a *AlterStatistics) Pos() token.Pos
func (*AlterStatistics) SQL ¶
func (s *AlterStatistics) SQL() string
type AlterTable ¶
type AlterTable struct { Alter token.Pos // position of "ALTER" keyword Name *Path TableAlteration TableAlteration }
AlterTable is ALTER TABLE statement node.
ALTER TABLE {{.Name | sql}} {{.TableAlteration | sql}}
func (*AlterTable) End ¶
func (a *AlterTable) End() token.Pos
func (*AlterTable) Pos ¶
func (a *AlterTable) Pos() token.Pos
func (*AlterTable) SQL ¶
func (a *AlterTable) SQL() string
type Arg ¶
type Arg interface { Node // contains filtered or unexported methods }
Arg represents argument of function call.
type ArrayLiteral ¶
type ArrayLiteral struct { Array token.Pos // position of "ARRAY" keyword, optional Lbrack, Rbrack token.Pos // position of "[" and "]" Type Type // optional Values []Expr }
ArrayLiteral is array literal node.
{{if .Array.Invalid | not}}ARRAY{{end}}{{if .Type}}<{{.Type | sql}}>{{end}}[{{.Values | sqlJoin ","}}]
func (*ArrayLiteral) End ¶
func (a *ArrayLiteral) End() token.Pos
func (*ArrayLiteral) Pos ¶
func (a *ArrayLiteral) Pos() token.Pos
func (*ArrayLiteral) SQL ¶
func (a *ArrayLiteral) SQL() string
type ArraySchemaType ¶
type ArraySchemaType struct { Array token.Pos // position of "ARRAY" keyword Gt token.Pos // position of ">" Rparen token.Pos // position of ")" when len(NamedArgs) > 0 Item SchemaType // ScalarSchemaType or SizedSchemaType or NamedType NamedArgs []*NamedArg }
ArraySchemaType is array type node in schema.
ARRAY<{{.Item | sql}}>{{if .NamedArgs}}({{.NamedArgs | sqlJoin ", "}}){{end}}
func (*ArraySchemaType) End ¶
func (a *ArraySchemaType) End() token.Pos
func (*ArraySchemaType) Pos ¶
func (a *ArraySchemaType) Pos() token.Pos
func (*ArraySchemaType) SQL ¶
func (a *ArraySchemaType) SQL() string
type ArraySubQuery ¶
type ArraySubQuery struct { Array token.Pos // position of "ARRAY" keyword Rparen token.Pos // position of ")" Query QueryExpr }
ArraySubQuery is subquery in ARRAY call.
ARRAY({{.Query | sql}})
func (*ArraySubQuery) End ¶
func (a *ArraySubQuery) End() token.Pos
func (*ArraySubQuery) Pos ¶
func (a *ArraySubQuery) Pos() token.Pos
func (*ArraySubQuery) SQL ¶
func (a *ArraySubQuery) SQL() string
type ArrayType ¶
type ArrayType struct { Array token.Pos // position of "ARRAY" keyword Gt token.Pos // position of ">" Item Type }
ArrayType is array type node.
ARRAY<{{.Item | sql}}>
type AsAlias ¶
AsAlias is AS clause node for general purpose.
It is used in Alias node and some JoinExpr nodes.
{{if not .As.Invalid}}AS {{end}}{{.Alias | sql}}
type AsTypeName ¶
AsTypeName represents AS typename node in SELECT clause.
AS {{.TypeName | sql}}
func (*AsTypeName) End ¶
func (a *AsTypeName) End() token.Pos
func (*AsTypeName) Pos ¶
func (a *AsTypeName) Pos() token.Pos
func (*AsTypeName) SQL ¶
func (a *AsTypeName) SQL() string
type AtTimeZone ¶
AtTimeZone is AT TIME ZONE clause in EXTRACT call.
AT TIME ZONE {{.Expr | sql}}
func (*AtTimeZone) End ¶
func (a *AtTimeZone) End() token.Pos
func (*AtTimeZone) Pos ¶
func (a *AtTimeZone) Pos() token.Pos
func (*AtTimeZone) SQL ¶
func (a *AtTimeZone) SQL() string
type AutoIncrement ¶ added in v0.4.0
AutoIncrement is AUTO_INCREMENT node.
AUTO_INCREMENT
func (*AutoIncrement) End ¶ added in v0.4.0
func (a *AutoIncrement) End() token.Pos
func (*AutoIncrement) Pos ¶ added in v0.4.0
func (a *AutoIncrement) Pos() token.Pos
func (*AutoIncrement) SQL ¶ added in v0.4.0
func (a *AutoIncrement) SQL() string
type BadDDL ¶
type BadDDL struct {
BadNode *BadNode
}
BadDDL is a BadNode for DDL.
{{.BadNode | sql}}
type BadExpr ¶
type BadExpr struct {
BadNode *BadNode
}
BadExpr is a BadNode for Expr.
{{.BadNode | sql}}
type BadNode ¶
BadNode is a placeholder node for a source code containing syntax errors.
{{.Tokens | tokenJoin}}
type BadQueryExpr ¶
BadQueryExpr is a BadNode for QueryExpr.
{{.BadNode | sql}}
func (*BadQueryExpr) End ¶
func (b *BadQueryExpr) End() token.Pos
func (*BadQueryExpr) Pos ¶
func (b *BadQueryExpr) Pos() token.Pos
func (*BadQueryExpr) SQL ¶
func (b *BadQueryExpr) SQL() string
type BadStatement ¶
BadStatement is a BadNode for Statement.
{{.Hint | sqlOpt}} {{.BadNode | sql}}
func (*BadStatement) End ¶
func (b *BadStatement) End() token.Pos
func (*BadStatement) Pos ¶
func (b *BadStatement) Pos() token.Pos
func (*BadStatement) SQL ¶
func (b *BadStatement) SQL() string
type BadType ¶
type BadType struct {
BadNode *BadNode
}
BadType is a BadNode for Type.
{{.BadNode | sql}}
type BetweenExpr ¶
BetweenExpr is BETWEEN expression node.
{{.Left | sql}} {{if .Not}}NOT{{end}} BETWEEN {{.RightStart | sql}} AND {{.RightEnd | sql}}
func (*BetweenExpr) End ¶
func (b *BetweenExpr) End() token.Pos
func (*BetweenExpr) Pos ¶
func (b *BetweenExpr) Pos() token.Pos
func (*BetweenExpr) SQL ¶
func (b *BetweenExpr) SQL() string
type BinaryExpr ¶
BinaryExpr is binary operator expression node.
{{.Left | sql}} {{.Op}} {{.Right | sql}}
func (*BinaryExpr) End ¶
func (b *BinaryExpr) End() token.Pos
func (*BinaryExpr) Pos ¶
func (b *BinaryExpr) Pos() token.Pos
func (*BinaryExpr) SQL ¶
func (b *BinaryExpr) SQL() string
type BinaryOp ¶
type BinaryOp string
const ( OpOr BinaryOp = "OR" OpAnd BinaryOp = "AND" OpEqual BinaryOp = "=" OpNotEqual BinaryOp = "!=" OpLess BinaryOp = "<" OpGreater BinaryOp = ">" OpLessEqual BinaryOp = "<=" OpGreaterEqual BinaryOp = ">=" OpLike BinaryOp = "LIKE" OpNotLike BinaryOp = "NOT LIKE" OpBitOr BinaryOp = "|" OpBitXor BinaryOp = "^" OpBitAnd BinaryOp = "&" OpBitLeftShift BinaryOp = "<<" OpBitRightShift BinaryOp = ">>" OpAdd BinaryOp = "+" OpSub BinaryOp = "-" OpMul BinaryOp = "*" OpDiv BinaryOp = "/" OpConcat BinaryOp = "||" )
type BitReversedPositive ¶
type BitReversedPositive struct {
BitReversedPositive token.Pos // position of "BIT_REVERSED_POSITIVE" keyword
}
BitReversedPositive is BIT_RESVERSED_POSITIVE node.
BIT_REVERSED_POSITIVE
func (*BitReversedPositive) End ¶
func (b *BitReversedPositive) End() token.Pos
func (*BitReversedPositive) Pos ¶
func (b *BitReversedPositive) Pos() token.Pos
func (*BitReversedPositive) SQL ¶
func (s *BitReversedPositive) SQL() string
type BoolLiteral ¶
BoolLiteral is boolean literal node.
{{if .Value}}TRUE{{else}}FALSE{{end}}
func (*BoolLiteral) End ¶
func (b *BoolLiteral) End() token.Pos
func (*BoolLiteral) Pos ¶
func (b *BoolLiteral) Pos() token.Pos
func (*BoolLiteral) SQL ¶
func (b *BoolLiteral) SQL() string
type BracedConstructor ¶
type BracedConstructor struct {
Lbrace, Rbrace token.Pos
Fields []*BracedConstructorField
}
BracedConstructor represents a single map constructor which is used in BracedNewConstructor. Actually, it is a top level Expr in syntax, but it is not permitted semantically in other place.
{{"{"}}{{.Fields | sqlJoin ", "}}{{"}"}}
func (*BracedConstructor) End ¶
func (b *BracedConstructor) End() token.Pos
func (*BracedConstructor) Pos ¶
func (b *BracedConstructor) Pos() token.Pos
func (*BracedConstructor) SQL ¶
func (b *BracedConstructor) SQL() string
type BracedConstructorField ¶
type BracedConstructorField struct { Name *Ident Value BracedConstructorFieldValue }
BracedConstructorField represents a single field in BracedConstructor.
{{.Name | sql}} {{.Value | sql}}
func (*BracedConstructorField) End ¶
func (b *BracedConstructorField) End() token.Pos
func (*BracedConstructorField) Pos ¶
func (b *BracedConstructorField) Pos() token.Pos
func (*BracedConstructorField) SQL ¶
func (b *BracedConstructorField) SQL() string
type BracedConstructorFieldValue ¶
type BracedConstructorFieldValue interface { Node // contains filtered or unexported methods }
BracedConstructorFieldValue represents value part of fields in BracedNewConstructor.
type BracedConstructorFieldValueExpr ¶
BracedConstructorFieldValueExpr represents a field value node.
: {{.Expr | sql}}
func (*BracedConstructorFieldValueExpr) End ¶
func (b *BracedConstructorFieldValueExpr) End() token.Pos
func (*BracedConstructorFieldValueExpr) Pos ¶
func (b *BracedConstructorFieldValueExpr) Pos() token.Pos
func (*BracedConstructorFieldValueExpr) SQL ¶
func (b *BracedConstructorFieldValueExpr) SQL() string
type BracedNewConstructor ¶
type BracedNewConstructor struct { New token.Pos Type *NamedType Body *BracedConstructor }
BracedNewConstructor represents NEW operator which creates a protocol buffer using a map constructor.
NEW {{.Type | sql}} {{"{"}}{{"}"}}
func (*BracedNewConstructor) End ¶
func (b *BracedNewConstructor) End() token.Pos
func (*BracedNewConstructor) Pos ¶
func (b *BracedNewConstructor) Pos() token.Pos
func (*BracedNewConstructor) SQL ¶
func (b *BracedNewConstructor) SQL() string
type BytesLiteral ¶
BytesLiteral is bytes literal node.
B{{.Value | sqlBytesQuote}}
func (*BytesLiteral) End ¶
func (b *BytesLiteral) End() token.Pos
func (*BytesLiteral) Pos ¶
func (b *BytesLiteral) Pos() token.Pos
func (*BytesLiteral) SQL ¶
func (b *BytesLiteral) SQL() string
type CallExpr ¶
type CallExpr struct { Rparen token.Pos // position of ")" Func *Path Distinct bool Args []Arg NamedArgs []*NamedArg NullHandling NullHandlingModifier // optional Having HavingModifier // optional Hint *Hint // optional }
CallExpr is function call expression node.
{{.Func | sql}}( {{if .Distinct}}DISTINCT{{end}} {{.Args | sqlJoin ", "}} {{if len(.Args) > 0 && len(.NamedArgs) > 0}}, {{end}} {{.NamedArgs | sqlJoin ", "}} {{.NullHandling | sqlOpt}} {{.Having | sqlOpt}} ) {{.Hint | sqlOpt}}
type CaseExpr ¶
type CaseExpr struct {
Case, EndPos token.Pos // position of "CASE" and "END" keywords
Expr Expr // optional
Whens []*CaseWhen // len(Whens) > 0
Else *CaseElse // optional
}
CaseExpr is CASE expression node.
CASE {{.Expr | sqlOpt}} {{.Whens | sqlJoin "\n"}} {{.Else | sqlOpt}} END
type CaseWhen ¶
CaseWhen is WHEN clause in CASE expression.
WHEN {{.Cond | sql}} THEN {{.Then | sql}}
type CastExpr ¶
type CastExpr struct { Cast token.Pos // position of "CAST" keyword or "SAFE_CAST" pseudo keyword Rparen token.Pos // position of ")" Safe bool Expr Expr Type Type }
CastExpr is CAST/SAFE_CAST call expression node.
{{if .Safe}}SAFE_{{end}}CAST({{.Expr | sql}} AS {{.Type | sql}})
type CastIntValue ¶
type CastIntValue struct { Cast token.Pos // position of "CAST" keyword Rparen token.Pos // position of ")" Expr IntValue // IntLit or Param }
CastIntValue is cast call in integer value context.
CAST({{.Expr | sql}} AS INT64)
func (*CastIntValue) End ¶
func (c *CastIntValue) End() token.Pos
func (*CastIntValue) Pos ¶
func (c *CastIntValue) Pos() token.Pos
func (*CastIntValue) SQL ¶
func (c *CastIntValue) SQL() string
type CastNumValue ¶
type CastNumValue struct { Cast token.Pos // position of "CAST" keyword Rparen token.Pos // position of ")" Expr NumValue // IntLit, FloatLit or Param Type ScalarTypeName // Int64Type or Float64Type }
CasrNumValue is cast call in number value context.
CAST({{.Expr | sql}} AS {{.Type}})
func (*CastNumValue) End ¶
func (c *CastNumValue) End() token.Pos
func (*CastNumValue) Pos ¶
func (c *CastNumValue) Pos() token.Pos
func (*CastNumValue) SQL ¶
func (c *CastNumValue) SQL() string
type ChangeStreamAlteration ¶
type ChangeStreamAlteration interface { Node // contains filtered or unexported methods }
ChangeStreamAlteration represents ALTER CHANGE STREAM action.
type ChangeStreamDropForAll ¶
type ChangeStreamDropForAll struct { Drop token.Pos // position of "DROP" keyword All token.Pos // position of "ALL" keyword }
ChangeStreamDropForAll is DROP FOR ALL node in ALTER CHANGE STREAM
DROP FOR ALL
func (*ChangeStreamDropForAll) End ¶
func (c *ChangeStreamDropForAll) End() token.Pos
func (*ChangeStreamDropForAll) Pos ¶
func (c *ChangeStreamDropForAll) Pos() token.Pos
func (ChangeStreamDropForAll) SQL ¶
func (a ChangeStreamDropForAll) SQL() string
type ChangeStreamFor ¶
type ChangeStreamFor interface { Node // contains filtered or unexported methods }
ChangeStreamFor represents FOR clause in CREATE/ALTER CHANGE STREAM statement.
type ChangeStreamForAll ¶
type ChangeStreamForAll struct { For token.Pos // position of "FOR" keyword All token.Pos // position of "ALL" keyword }
ChangeStreamForAll is FOR ALL node in CREATE CHANGE STREAM
FOR ALL
func (*ChangeStreamForAll) End ¶
func (c *ChangeStreamForAll) End() token.Pos
func (*ChangeStreamForAll) Pos ¶
func (c *ChangeStreamForAll) Pos() token.Pos
func (*ChangeStreamForAll) SQL ¶
func (c *ChangeStreamForAll) SQL() string
type ChangeStreamForTable ¶
type ChangeStreamForTable struct { Rparen token.Pos // position of ")" TableName *Ident Columns []*Ident }
ChangeStreamForTable table node in CREATE CHANGE STREAM SET FOR
{{.TableName | sql}}{{if .Columns}}({{.Columns | sqlJoin ","}}){{end}}
func (*ChangeStreamForTable) End ¶
func (c *ChangeStreamForTable) End() token.Pos
func (*ChangeStreamForTable) Pos ¶
func (c *ChangeStreamForTable) Pos() token.Pos
func (*ChangeStreamForTable) SQL ¶
func (c *ChangeStreamForTable) SQL() string
type ChangeStreamForTables ¶
type ChangeStreamForTables struct { For token.Pos // position of "FOR" keyword Tables []*ChangeStreamForTable }
ChangeStreamForTables is FOR tables node in CREATE CHANGE STREAM
FOR {{.Tables | sqlJoin ","}}
func (*ChangeStreamForTables) End ¶
func (c *ChangeStreamForTables) End() token.Pos
func (*ChangeStreamForTables) Pos ¶
func (c *ChangeStreamForTables) Pos() token.Pos
func (*ChangeStreamForTables) SQL ¶
func (c *ChangeStreamForTables) SQL() string
type ChangeStreamSetFor ¶
type ChangeStreamSetFor struct { Set token.Pos // position of "SET" keyword For ChangeStreamFor }
ChangeStreamSetFor is SET FOR tables node in ALTER CHANGE STREAM
SET FOR {{.For | sql}}
func (*ChangeStreamSetFor) End ¶
func (c *ChangeStreamSetFor) End() token.Pos
func (*ChangeStreamSetFor) Pos ¶
func (c *ChangeStreamSetFor) Pos() token.Pos
func (ChangeStreamSetFor) SQL ¶
func (a ChangeStreamSetFor) SQL() string
type ChangeStreamSetOptions ¶
ChangeStreamSetOptions is SET OPTIONS node in ALTER CHANGE STREAM
SET {{.Options | sql}}
func (*ChangeStreamSetOptions) End ¶
func (c *ChangeStreamSetOptions) End() token.Pos
func (*ChangeStreamSetOptions) Pos ¶
func (c *ChangeStreamSetOptions) Pos() token.Pos
func (ChangeStreamSetOptions) SQL ¶
func (a ChangeStreamSetOptions) SQL() string
type Check ¶
type Check struct { Check token.Pos // position of "CHECK" keyword Rparen token.Pos // position of ")" after Expr Expr Expr }
Check is check constraint in CREATE TABLE and ALTER TABLE.
Check ({{.Expr}})
type Cluster ¶
type Cluster struct { Comma token.Pos // position of "," OnDeleteEnd token.Pos // end position of ON DELETE clause TableName *Path OnDelete OnDeleteAction // optional }
Cluster is INTERLEAVE IN PARENT clause in CREATE TABLE.
, INTERLEAVE IN PARENT {{.TableName | sql}} {{.OnDelete}}
type Collate ¶
type Collate struct { Collate token.Pos // position of "COLLATE" keyword Value StringValue }
Collate is COLLATE clause node in ORDER BY item.
COLLATE {{.Value | sql}}
type ColumnAlteration ¶
type ColumnAlteration interface { Node // contains filtered or unexported methods }
ColumnAlteration represents ALTER COLUMN action in ALTER TABLE.
type ColumnDef ¶
type ColumnDef struct { Null token.Pos // position of "NULL" Key token.Pos // position of "KEY" of PRIMARY KEY Name *Ident Type SchemaType NotNull bool PrimaryKey bool DefaultSemantics ColumnDefaultSemantics // optional Hidden token.Pos // InvalidPos if not hidden Options *Options // optional }
ColumnDef is column definition in CREATE TABLE and ALTER TABLE ADD COLUMN. Note: Some fields are not valid in ADD COLUMN.
{{.Name | sql}} {{.Type | sql}} {{if .NotNull}}NOT NULL{{end}} {{.DefaultSemantics | sqlOpt}} {{if .Hidden.Invalid | not)}}HIDDEN{{end}} {{if .PrimaryKey}}PRIMARY KEY{{end}} {{.Options | sqlOpt}}
type ColumnDefaultExpr ¶
type ColumnDefaultExpr struct { Default token.Pos // position of "DEFAULT" keyword Rparen token.Pos // position of ")" Expr Expr }
ColumnDefaultExpr is a default value expression for the column.
DEFAULT ({{.Expr | sql}})
func (*ColumnDefaultExpr) End ¶
func (c *ColumnDefaultExpr) End() token.Pos
func (*ColumnDefaultExpr) Pos ¶
func (c *ColumnDefaultExpr) Pos() token.Pos
func (*ColumnDefaultExpr) SQL ¶
func (c *ColumnDefaultExpr) SQL() string
type ColumnDefaultSemantics ¶
type ColumnDefaultSemantics interface { Node // contains filtered or unexported methods }
ColumnDefaultSemantics is interface of DefaultExpr, GeneratedColumnExpr, IdentityColumn, AutoIncrement. They are change default value of column and mutually exclusive.
type CompoundQuery ¶
type CompoundQuery struct { Op SetOp AllOrDistinct AllOrDistinct Queries []QueryExpr // len(Queries) >= 2 }
CompoundQuery is query expression node compounded by set operators. Note: A single CompoundQuery can express query expressions compounded by the same set operator. If there are mixed Op or Distinct in query expression, CompoundQuery will be nested.
{{.Queries | sqlJoin (printf "%s %s" .Op .AllOrDistinct)}}
func (*CompoundQuery) End ¶
func (c *CompoundQuery) End() token.Pos
func (*CompoundQuery) Pos ¶
func (c *CompoundQuery) Pos() token.Pos
func (*CompoundQuery) SQL ¶
func (c *CompoundQuery) SQL() string
type Constraint ¶
type Constraint interface { Node // contains filtered or unexported methods }
Constraint represents table constraint of CONSTARINT clause.
type CountStarExpr ¶
type CountStarExpr struct { Count token.Pos // position of "COUNT" Rparen token.Pos // position of ")" }
CountStarExpr is node just for COUNT(*).
COUNT(*)
func (*CountStarExpr) End ¶
func (c *CountStarExpr) End() token.Pos
func (*CountStarExpr) Pos ¶
func (c *CountStarExpr) Pos() token.Pos
func (*CountStarExpr) SQL ¶
func (*CountStarExpr) SQL() string
type CreateChangeStream ¶
type CreateChangeStream struct { Create token.Pos // position of "CREATE" keyword Name *Ident For ChangeStreamFor // optional Options *Options // optional }
CreateChangeStream is CREATE CHANGE STREAM statement node.
CREATE CHANGE STREAM {{.Name | sql}} {{.For | sqlOpt}} {{.Options | sqlOpt}}
func (*CreateChangeStream) End ¶
func (c *CreateChangeStream) End() token.Pos
func (*CreateChangeStream) Pos ¶
func (c *CreateChangeStream) Pos() token.Pos
func (*CreateChangeStream) SQL ¶
func (c *CreateChangeStream) SQL() string
type CreateDatabase ¶
CreateDatabase is CREATE DATABASE statement node.
CREATE DATABASE {{.Name | sql}}
func (*CreateDatabase) End ¶
func (c *CreateDatabase) End() token.Pos
func (*CreateDatabase) Pos ¶
func (c *CreateDatabase) Pos() token.Pos
func (*CreateDatabase) SQL ¶
func (c *CreateDatabase) SQL() string
type CreateIndex ¶
type CreateIndex struct { Create token.Pos // position of "CREATE" keyword Rparen token.Pos // position of ")" Unique bool NullFiltered bool IfNotExists bool Name *Path TableName *Path Keys []*IndexKey Storing *Storing // optional InterleaveIn *InterleaveIn // optional }
CreateIndex is CREATE INDEX statement node.
CREATE {{if .Unique}}UNIQUE{{end}} {{if .NullFiltered}}NULL_FILTERED{{end}} INDEX {{if .IfExists}}IF NOT EXISTS{{end}} {{.Name | sql}} ON {{.TableName | sql}} ( {{.Keys | sqlJoin ","}} ) {{.Storing | sqlOpt}} {{.InterleaveIn | sqlOpt}}
func (*CreateIndex) End ¶
func (c *CreateIndex) End() token.Pos
func (*CreateIndex) Pos ¶
func (c *CreateIndex) Pos() token.Pos
func (*CreateIndex) SQL ¶
func (c *CreateIndex) SQL() string
type CreateModel ¶
type CreateModel struct { Create token.Pos // position of "CREATE" keyword Remote token.Pos // position of "REMOTE" keyword OrReplace bool IfNotExists bool Name *Ident InputOutput *CreateModelInputOutput // optional Options *Options // optional }
CreateModel is CREATE MODEL statement node.
CREATE {{if .OrReplace}}OR REPLACE{{end}} MODEL {{if .IfNotExists}}IF NOT EXISTS{{end}} {{.Name | sql}} {{.InputOutput | sqlOpt}} REMOTE {{.Options | sqlOpt}}
func (*CreateModel) End ¶
func (c *CreateModel) End() token.Pos
func (*CreateModel) Pos ¶
func (c *CreateModel) Pos() token.Pos
func (*CreateModel) SQL ¶
func (c *CreateModel) SQL() string
type CreateModelColumn ¶
type CreateModelColumn struct { Name *Ident DataType SchemaType Options *Options // optional }
CreateModelColumn is a single column definition node in CREATE MODEL.
{{.Name | sql}} {{.DataType | sql}} {{.Options | sqlOpt}}
func (*CreateModelColumn) End ¶
func (c *CreateModelColumn) End() token.Pos
func (*CreateModelColumn) Pos ¶
func (c *CreateModelColumn) Pos() token.Pos
func (*CreateModelColumn) SQL ¶
func (c *CreateModelColumn) SQL() string
type CreateModelInputOutput ¶
type CreateModelInputOutput struct { Input token.Pos Rparen token.Pos // position of the last ")" InputColumns []*CreateModelColumn OutputColumns []*CreateModelColumn }
CreateModelInputOutput is INPUT and OUTPUT column list node.
INPUT ({{.InputColumns | sqlJoin ", "}}) OUTPUT ({{.OutputColumns | sqlJoin ", "}})
func (*CreateModelInputOutput) End ¶
func (c *CreateModelInputOutput) End() token.Pos
func (*CreateModelInputOutput) Pos ¶
func (c *CreateModelInputOutput) Pos() token.Pos
func (*CreateModelInputOutput) SQL ¶
func (c *CreateModelInputOutput) SQL() string
type CreatePlacement ¶
type CreatePlacement struct { Create token.Pos // position of "CREATE" keyword Name *Ident Options *Options // optional }
CreatePlacement is CREATE PLACEMENT statement node.
CREATE PLACEMENT {{.Name | sql}} {{.Options | sqlOpt}}
func (*CreatePlacement) End ¶
func (c *CreatePlacement) End() token.Pos
func (*CreatePlacement) Pos ¶
func (c *CreatePlacement) Pos() token.Pos
func (*CreatePlacement) SQL ¶
func (c *CreatePlacement) SQL() string
type CreatePropertyGraph ¶ added in v0.3.0
type CreatePropertyGraph struct { Create token.Pos // position of "CREATE" keyword OrReplace bool IfNotExists bool Name *Ident Content *PropertyGraphContent }
CreatePropertyGraph is CREATE PROPERTY GRAPH statement node.
CREATE {{if .OrReplace}}OR REPLACE{{end}} PROPERTY GRAPH {{if .IfNotExists}}IF NOT EXISTS{{end}} {{.Name | sql}} {{.Content | sql}}
func (*CreatePropertyGraph) End ¶ added in v0.3.0
func (c *CreatePropertyGraph) End() token.Pos
func (*CreatePropertyGraph) Pos ¶ added in v0.3.0
func (c *CreatePropertyGraph) Pos() token.Pos
func (*CreatePropertyGraph) SQL ¶ added in v0.3.0
func (c *CreatePropertyGraph) SQL() string
type CreateProtoBundle ¶
type CreateProtoBundle struct { Create token.Pos // position of "CREATE" keyword Types *ProtoBundleTypes }
CreateProtoBundle is CREATE PROTO BUNDLE statement node.
CREATE PROTO BUNDLE {{.Types, | sql}}
func (*CreateProtoBundle) End ¶
func (c *CreateProtoBundle) End() token.Pos
func (*CreateProtoBundle) Pos ¶
func (c *CreateProtoBundle) Pos() token.Pos
func (*CreateProtoBundle) SQL ¶
func (b *CreateProtoBundle) SQL() string
type CreateRole ¶
CreateRole is CREATE ROLE statement node.
CREATE ROLE {{.Name | sql}}
func (*CreateRole) End ¶
func (c *CreateRole) End() token.Pos
func (*CreateRole) Pos ¶
func (c *CreateRole) Pos() token.Pos
func (*CreateRole) SQL ¶
func (c *CreateRole) SQL() string
type CreateRowDeletionPolicy ¶
type CreateRowDeletionPolicy struct { Comma token.Pos // position of "," RowDeletionPolicy *RowDeletionPolicy }
CreateRowDeletionPolicy is ROW DELETION POLICY clause in CREATE TABLE.
, {{.RowDeletionPolicy}}
func (*CreateRowDeletionPolicy) End ¶
func (c *CreateRowDeletionPolicy) End() token.Pos
func (*CreateRowDeletionPolicy) Pos ¶
func (c *CreateRowDeletionPolicy) Pos() token.Pos
func (*CreateRowDeletionPolicy) SQL ¶
func (c *CreateRowDeletionPolicy) SQL() string
type CreateSchema ¶
CreateSchema is CREATE SCHEMA statement node.
CREATE SCHEMA {{.Name | sql}}
func (*CreateSchema) End ¶
func (c *CreateSchema) End() token.Pos
func (*CreateSchema) Pos ¶
func (c *CreateSchema) Pos() token.Pos
func (*CreateSchema) SQL ¶
func (s *CreateSchema) SQL() string
type CreateSearchIndex ¶
type CreateSearchIndex struct { Create token.Pos Name *Ident TableName *Ident TokenListPart []*Ident Rparen token.Pos // position of ")" after TokenListPart Storing *Storing // optional PartitionColumns []*Ident // optional OrderBy *OrderBy // optional Where *Where // optional Interleave *InterleaveIn // optional Options *Options // optional }
CreateSearchIndex represents CREATE SEARCH INDEX statement
CREATE SEARCH INDEX {{.Name | sql}} ON {{.TableName | sql}} ({{.TokenListPart | sqlJoin ", "}}) {{.Storing | sqlOpt}} {{if .PartitionColumns}}PARTITION BY {{.PartitionColumns | sqlJoin ", "}}{{end}} {{.OrderBy | sqlOpt}} {{.Where | sqlOpt}} {{.Interleave | sqlOpt}} {{.Options | sqlOpt}}
func (*CreateSearchIndex) End ¶
func (c *CreateSearchIndex) End() token.Pos
func (*CreateSearchIndex) Pos ¶
func (c *CreateSearchIndex) Pos() token.Pos
func (*CreateSearchIndex) SQL ¶
func (c *CreateSearchIndex) SQL() string
type CreateSequence ¶
type CreateSequence struct { Create token.Pos // position of "CREATE" keyword Name *Path IfNotExists bool Params []SequenceParam // len(Params) >= 0 Options *Options // optional }
CreateSequence is CREATE SEQUENCE statement node.
CREATE SEQUENCE {{if .IfNotExists}}IF NOT EXISTS{{end}} {{.Name | sql}} }} {{.Params | sqlJoin " "}} {{.Options | sql}}
func (*CreateSequence) End ¶
func (c *CreateSequence) End() token.Pos
func (*CreateSequence) Pos ¶
func (c *CreateSequence) Pos() token.Pos
func (*CreateSequence) SQL ¶
func (c *CreateSequence) SQL() string
type CreateTable ¶
type CreateTable struct { Create token.Pos // position of "CREATE" keyword Rparen token.Pos // position of ")" of end of column definitions PrimaryKeyRparen token.Pos // position of ")" of PRIMARY KEY clause, optional IfNotExists bool Name *Path Columns []*ColumnDef TableConstraints []*TableConstraint PrimaryKeys []*IndexKey // when omitted, len(PrimaryKeys) = 0 Synonyms []*Synonym Cluster *Cluster // optional RowDeletionPolicy *CreateRowDeletionPolicy // optional }
CreateTable is CREATE TABLE statement node.
CREATE TABLE {{if .IfNotExists}}IF NOT EXISTS{{end}} {{.Name | sql}} ( {{.Columns | sqlJoin ","}}{{if and .Columns (or .TableConstrains .Synonym)}},{{end}} {{.TableConstraints | sqlJoin ","}}{{if and .TableConstraints .Synonym}},{{end}} {{.Synonym | sqlJoin ","}} ) {{if .PrimaryKeys}}PRIMARY KEY ({{.PrimaryKeys | sqlJoin ","}}){{end}} {{.Cluster | sqlOpt}} {{.CreateRowDeletionPolicy | sqlOpt}}
Spanner SQL allows to mix `Columns` and `TableConstraints` and `Synonyms`, however they are separated in AST definition for historical reasons. If you want to get the original order of them, please sort them by their `Pos()`.
func (*CreateTable) End ¶
func (c *CreateTable) End() token.Pos
func (*CreateTable) Pos ¶
func (c *CreateTable) Pos() token.Pos
func (*CreateTable) SQL ¶
func (c *CreateTable) SQL() string
type CreateVectorIndex ¶
type CreateVectorIndex struct { Create token.Pos // position of "CREATE" keyword IfNotExists bool // optional Name *Ident TableName *Ident ColumnName *Ident // It only allows `WHERE column_name IS NOT NULL` for now, but we still relax the condition // by reusing the `parseWhere` function for sake of it may be extended more conditions in the future. // // Reference: https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#vector_index_statements Where *Where // optional Options *Options }
CreateVectorIndex is CREATE VECTOR INDEX statement node.
CREATE VECTOR INDEX {if .IfNotExists}}IF NOT EXISTS{{end}} {{.Name | sql}} ON {{.TableName | sql}}({{.ColumnName | sql}}) {{if .Where}}WHERE {{.Where | sql}}{{end}} {{.Options | sql}}
func (*CreateVectorIndex) End ¶
func (c *CreateVectorIndex) End() token.Pos
func (*CreateVectorIndex) Pos ¶
func (c *CreateVectorIndex) Pos() token.Pos
func (*CreateVectorIndex) SQL ¶
func (c *CreateVectorIndex) SQL() string
type CreateView ¶
type CreateView struct { Create token.Pos Name *Path OrReplace bool SecurityType SecurityType Query QueryExpr }
CreateView is CREATE VIEW statement node.
CREATE {{if .OrReplace}}OR REPLACE{{end}} VIEW {{.Name | sql}} SQL SECURITY {{.SecurityType}} AS {{.Query | sql}}
func (*CreateView) End ¶
func (c *CreateView) End() token.Pos
func (*CreateView) Pos ¶
func (c *CreateView) Pos() token.Pos
func (*CreateView) SQL ¶
func (c *CreateView) SQL() string
type DDL ¶
type DDL interface { Statement // contains filtered or unexported methods }
DDL represents data definition language in SQL.
https://cloud.google.com/spanner/docs/data-definition-language
type DML ¶
type DML interface { Statement // contains filtered or unexported methods }
DML represents data manipulation language in SQL.
https://cloud.google.com/spanner/docs/data-definition-language
type DateLiteral ¶
type DateLiteral struct { Date token.Pos // position of "DATE" Value *StringLiteral }
DateLiteral is date literal node.
DATE {{.Value | sql}}
func (*DateLiteral) End ¶
func (d *DateLiteral) End() token.Pos
func (*DateLiteral) Pos ¶
func (d *DateLiteral) Pos() token.Pos
func (*DateLiteral) SQL ¶
func (d *DateLiteral) SQL() string
type DefaultExpr ¶
DefaultExpr is DEFAULT or Expr.
{{if .Default}}DEFAULT{{else}}{{.Expr | sql}}{{end}}
func (*DefaultExpr) End ¶
func (d *DefaultExpr) End() token.Pos
func (*DefaultExpr) Pos ¶
func (d *DefaultExpr) Pos() token.Pos
func (*DefaultExpr) SQL ¶
func (d *DefaultExpr) SQL() string
type Delete ¶
type Delete struct { Delete token.Pos // position of "DELETE" keyword Hint *Hint // optional TableName *Path TableHint *Hint // optional As *AsAlias // optional Where *Where ThenReturn *ThenReturn // optional }
Delete is DELETE statement.
{{.Hint | sqlOpt}} DELETE FROM {{.TableName | sql}}{{.TableHint | sqlOpt}} {{.As | sqlOpt}} {{.Where | sql}} {{.ThenReturn | sqlOpt}}
type DeletePrivilege ¶
DeletePrivilege is DELETE ON TABLE privilege node in GRANT and REVOKE.
DELETE
func (*DeletePrivilege) End ¶
func (d *DeletePrivilege) End() token.Pos
func (*DeletePrivilege) Pos ¶
func (d *DeletePrivilege) Pos() token.Pos
func (*DeletePrivilege) SQL ¶
func (d *DeletePrivilege) SQL() string
type DotStar ¶
type DotStar struct { Star token.Pos // position of "*" Expr Expr Except *StarModifierExcept // optional Replace *StarModifierReplace // optional }
DotStar is expression with * in SELECT result columns list.
{{.Expr | sql}}.* {{.Except | sqlOpt}} {{.Replace | sqlOpt}}
type DropChangeStream ¶
DropChangeStream is DROP CHANGE STREAM statement node.
DROP CHANGE STREAM {{.Name | sql}}
func (*DropChangeStream) End ¶
func (d *DropChangeStream) End() token.Pos
func (*DropChangeStream) Pos ¶
func (d *DropChangeStream) Pos() token.Pos
func (*DropChangeStream) SQL ¶
func (d *DropChangeStream) SQL() string
type DropColumn ¶
DropColumn is DROP COLUMN clause in ALTER TABLE.
DROP COLUMN {{.Name | sql}}
func (*DropColumn) End ¶
func (d *DropColumn) End() token.Pos
func (*DropColumn) Pos ¶
func (d *DropColumn) Pos() token.Pos
func (*DropColumn) SQL ¶
func (d *DropColumn) SQL() string
type DropConstraint ¶
DropConstraint is DROP CONSTRAINT clause in ALTER TABLE.
DROP CONSTRAINT {{.Name | sql}}
func (*DropConstraint) End ¶
func (d *DropConstraint) End() token.Pos
func (*DropConstraint) Pos ¶
func (d *DropConstraint) Pos() token.Pos
func (*DropConstraint) SQL ¶
func (d *DropConstraint) SQL() string
type DropIndex ¶
DropIndex is DROP INDEX statement node.
DROP INDEX {{if .IfExists}}IF EXISTS{{end}} {{.Name | sql}}
type DropModel ¶
DropModel is DROP MODEL statement node.
DROP MODEL {{if .IfExists}}IF EXISTS{{end}} {{.Name | sql}}
type DropPropertyGraph ¶ added in v0.3.0
DropPropertyGraph is DROP PROPERTY GRAPH statement node.
DROP PROPERTY GRAPH {{if .IfExists}}IF EXISTS{{end}} {{.Name | sql}}
func (*DropPropertyGraph) End ¶ added in v0.3.0
func (d *DropPropertyGraph) End() token.Pos
func (*DropPropertyGraph) Pos ¶ added in v0.3.0
func (d *DropPropertyGraph) Pos() token.Pos
func (*DropPropertyGraph) SQL ¶ added in v0.3.0
func (g *DropPropertyGraph) SQL() string
type DropProtoBundle ¶
type DropProtoBundle struct { Drop token.Pos // position of "DROP" pseudo keyword Bundle token.Pos // position of "BUNDLE" pseudo keyword }
DropProtoBundle is DROP PROTO BUNDLE statement node.
DROP PROTO BUNDLE
func (*DropProtoBundle) End ¶
func (d *DropProtoBundle) End() token.Pos
func (*DropProtoBundle) Pos ¶
func (d *DropProtoBundle) Pos() token.Pos
func (*DropProtoBundle) SQL ¶
func (d *DropProtoBundle) SQL() string
type DropRowDeletionPolicy ¶
type DropRowDeletionPolicy struct { Drop token.Pos // position of "DROP" keyword Policy token.Pos // position of "POLICY" keyword }
DropRowDeletionPolicy is DROP ROW DELETION POLICY clause in ALTER TABLE.
DROP ROW DELETION POLICY
func (*DropRowDeletionPolicy) End ¶
func (d *DropRowDeletionPolicy) End() token.Pos
func (*DropRowDeletionPolicy) Pos ¶
func (d *DropRowDeletionPolicy) Pos() token.Pos
func (*DropRowDeletionPolicy) SQL ¶
func (d *DropRowDeletionPolicy) SQL() string
type DropSchema ¶
DropSchema is DROP SCHEMA statement node.
DROP SCHEMA {{.Name | sql}}
func (*DropSchema) End ¶
func (d *DropSchema) End() token.Pos
func (*DropSchema) Pos ¶
func (d *DropSchema) Pos() token.Pos
func (*DropSchema) SQL ¶
func (s *DropSchema) SQL() string
type DropSearchIndex ¶
DropSearchIndex represents DROP SEARCH INDEX statement.
DROP SEARCH INDEX{{if .IfExists}}IF EXISTS{{end}} {{Name | sql}}
func (*DropSearchIndex) End ¶
func (d *DropSearchIndex) End() token.Pos
func (*DropSearchIndex) Pos ¶
func (d *DropSearchIndex) Pos() token.Pos
func (*DropSearchIndex) SQL ¶
func (d *DropSearchIndex) SQL() string
type DropSequence ¶
DropSequence is DROP SEQUENCE statement node.
DROP SEQUENCE {{if .IfExists}}IF EXISTS{{end}} {{.Name | sql}}
func (*DropSequence) End ¶
func (d *DropSequence) End() token.Pos
func (*DropSequence) Pos ¶
func (d *DropSequence) Pos() token.Pos
func (*DropSequence) SQL ¶
func (d *DropSequence) SQL() string
type DropStoredColumn ¶
DropStoredColumn is DROP STORED COLUMN clause in ALTER INDEX.
DROP STORED COLUMN {{.Name | sql}}
func (*DropStoredColumn) End ¶
func (d *DropStoredColumn) End() token.Pos
func (*DropStoredColumn) Pos ¶
func (d *DropStoredColumn) Pos() token.Pos
func (*DropStoredColumn) SQL ¶
func (a *DropStoredColumn) SQL() string
type DropSynonym ¶
DropSynonym is DROP SYNONYM node in ALTER TABLE.
DROP SYNONYM {{.Name | sql}}
func (*DropSynonym) End ¶
func (d *DropSynonym) End() token.Pos
func (*DropSynonym) Pos ¶
func (d *DropSynonym) Pos() token.Pos
func (*DropSynonym) SQL ¶
func (s *DropSynonym) SQL() string
type DropTable ¶
DropTable is DROP TABLE statement node.
DROP TABLE {{if .IfExists}}IF NOT EXISTS{{end}} {{.Name | sql}}
type DropVectorIndex ¶
type DropVectorIndex struct { Drop token.Pos // position of "DROP" keyword IfExists bool Name *Ident }
DropVectorIndex is DROP VECTOR INDEX statement node.
DROP VECTOR INDEX {{if .IfExists}}IF EXISTS{{end}} {{.Name | sql}}
func (*DropVectorIndex) End ¶
func (d *DropVectorIndex) End() token.Pos
func (*DropVectorIndex) Pos ¶
func (d *DropVectorIndex) Pos() token.Pos
func (*DropVectorIndex) SQL ¶
func (d *DropVectorIndex) SQL() string
type ExecutePrivilegeOnTableFunction ¶
ExecutePrivilegeOnTableFunction is EXECUTE ON TABLE FUNCTION privilege node in GRANT and REVOKE.
EXECUTE ON TABLE FUNCTION {{.Names | sqlJoin ","}}
func (*ExecutePrivilegeOnTableFunction) End ¶
func (e *ExecutePrivilegeOnTableFunction) End() token.Pos
func (*ExecutePrivilegeOnTableFunction) Pos ¶
func (e *ExecutePrivilegeOnTableFunction) Pos() token.Pos
func (*ExecutePrivilegeOnTableFunction) SQL ¶
func (e *ExecutePrivilegeOnTableFunction) SQL() string
type ExistsSubQuery ¶
type ExistsSubQuery struct { Exists token.Pos // position of "EXISTS" keyword Rparen token.Pos // position of ")" Hint *Hint Query QueryExpr }
ExistsSubQuery is subquery in EXISTS call.
EXISTS {{.Hint | sqlOpt}} ({{.Query | sql}})
func (*ExistsSubQuery) End ¶
func (e *ExistsSubQuery) End() token.Pos
func (*ExistsSubQuery) Pos ¶
func (e *ExistsSubQuery) Pos() token.Pos
func (*ExistsSubQuery) SQL ¶
func (e *ExistsSubQuery) SQL() string
type Expr ¶
type Expr interface { Node // contains filtered or unexported methods }
Expr repersents an expression in SQL.
type ExprArg ¶
type ExprArg struct {
Expr Expr
}
ExprArg is argument of the generic function call.
{{.Expr | sql}}
type ExprSelectItem ¶
type ExprSelectItem struct {
Expr Expr
}
ExprSelectItem is Expr wrapper for SelectItem.
{{.Expr | sql}}
func (*ExprSelectItem) End ¶
func (e *ExprSelectItem) End() token.Pos
func (*ExprSelectItem) Pos ¶
func (e *ExprSelectItem) Pos() token.Pos
func (*ExprSelectItem) SQL ¶
func (e *ExprSelectItem) SQL() string
type ExtractExpr ¶
type ExtractExpr struct { Extract token.Pos // position of "EXTRACT" keyword Rparen token.Pos // position of ")" Part *Ident Expr Expr AtTimeZone *AtTimeZone // optional }
ExtractExpr is EXTRACT call expression node.
EXTRACT({{.Part | sql}} FROM {{.Expr | sql}} {{.AtTimeZone | sqlOpt}})
func (*ExtractExpr) End ¶
func (e *ExtractExpr) End() token.Pos
func (*ExtractExpr) Pos ¶
func (e *ExtractExpr) Pos() token.Pos
func (*ExtractExpr) SQL ¶
func (e *ExtractExpr) SQL() string
type FloatLiteral ¶
FloatLiteral is floating point number literal node.
{{.Value}}
func (*FloatLiteral) End ¶
func (f *FloatLiteral) End() token.Pos
func (*FloatLiteral) Pos ¶
func (f *FloatLiteral) Pos() token.Pos
func (*FloatLiteral) SQL ¶
func (f *FloatLiteral) SQL() string
type ForeignKey ¶
type ForeignKey struct { Foreign token.Pos // position of "FOREIGN" keyword Rparen token.Pos // position of ")" after reference columns OnDeleteEnd token.Pos // end position of ON DELETE clause Columns []*Ident ReferenceTable *Path ReferenceColumns []*Ident // len(ReferenceColumns) > 0 OnDelete OnDeleteAction // optional }
ForeignKey is foreign key specifier in CREATE TABLE and ALTER TABLE.
FOREIGN KEY ({{.ColumnNames | sqlJoin ","}}) REFERENCES {{.ReferenceTable}} ({{.ReferenceColumns | sqlJoin ","}}) {{.OnDelete}}
func (*ForeignKey) End ¶
func (f *ForeignKey) End() token.Pos
func (*ForeignKey) Pos ¶
func (f *ForeignKey) Pos() token.Pos
func (*ForeignKey) SQL ¶
func (f *ForeignKey) SQL() string
type FromQuery ¶
type FromQuery struct {
From *From
}
FromQuery is FROM query expression node.
FROM {{.From | sql}}
type GeneratedColumnExpr ¶
type GeneratedColumnExpr struct { As token.Pos // position of "AS" keyword Stored token.Pos // position of "STORED" keyword, optional Rparen token.Pos // position of ")" Expr Expr }
GeneratedColumnExpr is generated column expression.
AS ({{.Expr | sql}}) {{if .IsStored}}STORED{{end}}
func (*GeneratedColumnExpr) End ¶
func (g *GeneratedColumnExpr) End() token.Pos
func (*GeneratedColumnExpr) Pos ¶
func (g *GeneratedColumnExpr) Pos() token.Pos
func (*GeneratedColumnExpr) SQL ¶
func (g *GeneratedColumnExpr) SQL() string
type Grant ¶
type Grant struct { Grant token.Pos // position of "GRANT" keyword Privilege Privilege Roles []*Ident }
Grant is GRANT statement node.
GRANT {{.Privilege | sql}} TO ROLE {{.Roles | sqlJoin ","}}
type GroupBy ¶
type GroupBy struct { Group token.Pos // position of "GROUP" keyword Exprs []Expr // len(Exprs) > 0 }
GroupBy is GROUP BY clause node.
GROUP BY {{.Exprs | sqlJoin ","}}
type HavingMax ¶
HavingMax represents HAVING MAX of aggregate function calls.
HAVING MAX {{Expr | sql}}
type HavingMin ¶
HavingMin represents HAVING MIN of aggregate function calls.
HAVING MIN {{Expr | sql}}
type HavingModifier ¶
type HavingModifier interface { Node // contains filtered or unexported methods }
HavingModifier represents HAVING clause of aggregate function calls.
type Hint ¶
type Hint struct { Atmark token.Pos // position of "@" Rbrace token.Pos // position of "}" Records []*HintRecord // len(Records) > 0 }
Hint is hint node.
@{{"{"}}{{.Records | sqlJoin ","}}{{"}"}}
type HintRecord ¶
HintRecord is hint record node.
{{.Key | sql}}={{.Value | sql}}
func (*HintRecord) End ¶
func (h *HintRecord) End() token.Pos
func (*HintRecord) Pos ¶
func (h *HintRecord) Pos() token.Pos
func (*HintRecord) SQL ¶
func (h *HintRecord) SQL() string
type IdentityAlteration ¶
type IdentityAlteration interface { Node // contains filtered or unexported methods }
type IdentityColumn ¶
type IdentityColumn struct { Generated token.Pos // position of "GENERATED" keyword Identity token.Pos // position of "IDENTITY" keyword Rparen token.Pos // position of ")", optional Params []SequenceParam // if Rparen.Invalid() then len(Param) = 0 else len(Param) > 0 }
IdentityColumn is GENERATED BY DEFAULT AS IDENTITY node.
GENERATED BY DEFAULT AS IDENTITY {{if not(.Rparen.Invalid)}}({{.Params | sqlJoin " "}})
func (*IdentityColumn) End ¶
func (i *IdentityColumn) End() token.Pos
func (*IdentityColumn) Pos ¶
func (i *IdentityColumn) Pos() token.Pos
func (*IdentityColumn) SQL ¶
func (i *IdentityColumn) SQL() string
type IfExpr ¶
type IfExpr struct { If token.Pos // position of "IF" keyword Rparen token.Pos // position of ")" Expr Expr TrueResult Expr ElseResult Expr }
IfExpr is IF conditional expression. Because IF is SQL keyword, it can't be a normal CallExpr.
IF({{.Expr | sql}}, {{.TrueResult | sql}}, {{.ElseResult | sql}})
type IgnoreNulls ¶
IgnoreNulls represents IGNORE NULLS of aggregate function calls.
IGNORE NULLS
func (*IgnoreNulls) End ¶
func (i *IgnoreNulls) End() token.Pos
func (*IgnoreNulls) Pos ¶
func (i *IgnoreNulls) Pos() token.Pos
func (*IgnoreNulls) SQL ¶
func (i *IgnoreNulls) SQL() string
type InCondition ¶
type InCondition interface { Node // contains filtered or unexported methods }
InCondition is right-side value of IN operator.
type InExpr ¶
type InExpr struct { Not bool Left Expr Right InCondition }
InExpr is IN expression node.
{{.Left | sql}} {{if .Not}}NOT{{end}} IN {{.Right | sql}}
type IndexAlteration ¶
type IndexAlteration interface { Node // contains filtered or unexported methods }
IndexAlteration represents ALTER INDEX action.
type IndexExpr ¶
type IndexExpr struct { Rbrack token.Pos // position of "]" Expr Expr Index SubscriptSpecifier }
IndexExpr is a subscript operator expression node. This node can be:
- array subscript operator
- struct subscript operator
- JSON subscript operator
Note: The name IndexExpr is a historical reason, maybe better to rename to SubscriptExpr.
{{.Expr | sql}}[{{.Index | sql}}]
type IndexKey ¶
IndexKey is index key specifier in CREATE TABLE and CREATE INDEX.
{{.Name | sql}} {{.Dir}}
type Insert ¶
type Insert struct { Insert token.Pos // position of "INSERT" keyword InsertOrType InsertOrType Hint *Hint // optional TableName *Path TableHint *Hint // optional Columns []*Ident Input InsertInput ThenReturn *ThenReturn // optional }
Insert is INSERT statement node.
{{.Hint | sqlOpt}} INSERT {{if .InsertOrType}}OR .InsertOrType{{end}}INTO {{.TableName | sql}}{{.TableHint | sqlOpt}} ({{.Columns | sqlJoin ","}}) {{.Input | sql}} {{.ThenReturn | sqlOpt}}
type InsertInput ¶
type InsertInput interface { Node // contains filtered or unexported methods }
InsertInput represents input values of INSERT statement.
type InsertOrType ¶
type InsertOrType string
const ( InsertOrTypeUpdate InsertOrType = "UPDATE" InsertOrTypeIgnore InsertOrType = "IGNORE" )
type InsertPrivilege ¶
type InsertPrivilege struct { Insert token.Pos // position of "INSERT" keyword Rparen token.Pos // position of ")" when len(Columns) > 0 Columns []*Ident }
InsertPrivilege is INSERT ON TABLE privilege node in GRANT and REVOKE.
INSERT{{if .Columns}}({{.Columns | sqlJoin ","}}){{end}}
func (*InsertPrivilege) End ¶
func (i *InsertPrivilege) End() token.Pos
func (*InsertPrivilege) Pos ¶
func (i *InsertPrivilege) Pos() token.Pos
func (*InsertPrivilege) SQL ¶
func (i *InsertPrivilege) SQL() string
type IntLiteral ¶
type IntLiteral struct {
ValuePos, ValueEnd token.Pos // position of this value
Base int // 10 or 16
Value string
}
IntLiteral is integer literal node.
{{.Value}}
func (*IntLiteral) End ¶
func (i *IntLiteral) End() token.Pos
func (*IntLiteral) Pos ¶
func (i *IntLiteral) Pos() token.Pos
func (*IntLiteral) SQL ¶
func (i *IntLiteral) SQL() string
type IntValue ¶
type IntValue interface { Node // contains filtered or unexported methods }
IntValue represents integer values in SQL.
type InterleaveIn ¶
InterleaveIn is INTERLEAVE IN clause in CREATE INDEX.
, INTERLEAVE IN {{.TableName | sql}}
func (*InterleaveIn) End ¶
func (i *InterleaveIn) End() token.Pos
func (*InterleaveIn) Pos ¶
func (i *InterleaveIn) Pos() token.Pos
func (*InterleaveIn) SQL ¶
func (i *InterleaveIn) SQL() string
type IntervalArg ¶
type IntervalArg struct { Interval token.Pos // position of "INTERVAL" keyword Expr Expr Unit *Ident // optional }
IntervalArg is argument of date function call.
INTERVAL {{.Expr | sql}} {{.Unit | sqlOpt}}
func (*IntervalArg) End ¶
func (i *IntervalArg) End() token.Pos
func (*IntervalArg) Pos ¶
func (i *IntervalArg) Pos() token.Pos
func (*IntervalArg) SQL ¶
func (i *IntervalArg) SQL() string
type IsBoolExpr ¶
IsBoolExpr is IS TRUE/FALSE expression node.
{{.Left | sql}} IS {{if .Not}}NOT{{end}} {{if .Right}}TRUE{{else}}FALSE{{end}}
func (*IsBoolExpr) End ¶
func (i *IsBoolExpr) End() token.Pos
func (*IsBoolExpr) Pos ¶
func (i *IsBoolExpr) Pos() token.Pos
func (*IsBoolExpr) SQL ¶
func (i *IsBoolExpr) SQL() string
type IsNullExpr ¶
IsNullExpr is IS NULL expression node.
{{.Left | sql}} IS {{if .Not}}NOT{{end}} NULL
func (*IsNullExpr) End ¶
func (i *IsNullExpr) End() token.Pos
func (*IsNullExpr) Pos ¶
func (i *IsNullExpr) Pos() token.Pos
func (*IsNullExpr) SQL ¶
func (i *IsNullExpr) SQL() string
type JSONLiteral ¶
type JSONLiteral struct { JSON token.Pos // position of "JSON" Value *StringLiteral }
JSONLiteral is JSON literal node.
JSON {{.Value | sql}}
func (*JSONLiteral) End ¶
func (j *JSONLiteral) End() token.Pos
func (*JSONLiteral) Pos ¶
func (j *JSONLiteral) Pos() token.Pos
func (*JSONLiteral) SQL ¶
func (t *JSONLiteral) SQL() string
type Join ¶
type Join struct { Left TableExpr Op JoinOp Method JoinMethod Hint *Hint // optional Right TableExpr // nil when Op is CrossJoin // optional when Right is PathTableExpr or Unnest // otherwise it must be set. Cond JoinCondition }
Join is JOIN expression.
{{.Left | sql}} {{.Op}} {{.Method}} {{.Hint | sqlOpt}} {{.Right | sql}} {{.Cond | sqlOpt}}
type JoinCondition ¶
type JoinCondition interface { Node // contains filtered or unexported methods }
JoinCondition represents condition part of JOIN expression.
type JoinMethod ¶
type JoinMethod string
const ( HashJoinMethod JoinMethod = "HASH" LookupJoinMethod JoinMethod = "LOOKUP" // Undocumented, but the GoogleSQL can parse this value. )
type LambdaArg ¶
type LambdaArg struct { Lparen token.Pos // optional Args []*Ident // if Lparen.Invalid() then len(Args) = 1 else len(Args) > 0 Expr Expr }
LambdaArg is lambda expression argument of the generic function call.
{{if .Lparen.Invalid}}{{.Args | sqlJoin ", "}}{{else}}({{.Args | sqlJoin ", "}}) -> {{.Expr | sql}}
Note: Args won't be empty. If Lparen is not appeared, Args have exactly one element.
type Limit ¶
type Limit struct { Limit token.Pos // position of "LIMIT" keyword Count IntValue Offset *Offset // optional }
Limit is LIMIT clause node.
LIMIT {{.Count | sql}} {{.Offset | sqlOpt}}
type NamedArg ¶
NamedArg represents a name and value pair in named arguments
{{.Name | sql}} => {{.Value | sql}}
type NamedType ¶
type NamedType struct {
Path []*Ident // len(Path) > 0
}
NamedType is named type node. It is currently PROTO or ENUM. Name is full qualified name, but it can be len(Name) == 1 if it doesn't contain ".".
{{.Path | sqlJoin "."}}
type NewConstructor ¶
type NewConstructor struct { New token.Pos Type *NamedType Args []NewConstructorArg Rparen token.Pos }
NewConstructor represents NEW operator which creates a protocol buffer using a parenthesized list of arguments.
NEW {{.Type | sql}} ({{.Args | sqlJoin ", "}})
func (*NewConstructor) End ¶
func (n *NewConstructor) End() token.Pos
func (*NewConstructor) Pos ¶
func (n *NewConstructor) Pos() token.Pos
func (*NewConstructor) SQL ¶
func (n *NewConstructor) SQL() string
type NewConstructorArg ¶
type NewConstructorArg interface { Node // contains filtered or unexported methods }
NewConstructorArg represents an argument of NEW constructors.
type NoSkipRange ¶
NoSkipRange is NO SKIP RANGE node.
NO SKIP RANGE
func (*NoSkipRange) End ¶
func (n *NoSkipRange) End() token.Pos
func (*NoSkipRange) Pos ¶
func (n *NoSkipRange) Pos() token.Pos
func (*NoSkipRange) SQL ¶
func (s *NoSkipRange) SQL() string
type Node ¶
type Node interface { Pos() token.Pos End() token.Pos // Convert AST node into SQL source string (a.k.a. Unparse). SQL() string }
Node is base interface of Spanner SQL AST nodes.
type NullHandlingModifier ¶
type NullHandlingModifier interface { Node // contains filtered or unexported methods }
NullHandlingModifier represents IGNORE/RESPECT NULLS of aggregate function calls
type NullLiteral ¶
NullLiteral is just NULL literal.
NULL
func (*NullLiteral) End ¶
func (n *NullLiteral) End() token.Pos
func (*NullLiteral) Pos ¶
func (n *NullLiteral) Pos() token.Pos
func (*NullLiteral) SQL ¶
func (*NullLiteral) SQL() string
type NumValue ¶
type NumValue interface { Node // contains filtered or unexported methods }
NumValue represents number values in SQL.
type NumericLiteral ¶
type NumericLiteral struct { Numeric token.Pos // position of "NUMERIC" Value *StringLiteral }
NumericLiteral is numeric literal node.
NUMERIC {{.Value | sql}}
func (*NumericLiteral) End ¶
func (n *NumericLiteral) End() token.Pos
func (*NumericLiteral) Pos ¶
func (n *NumericLiteral) Pos() token.Pos
func (*NumericLiteral) SQL ¶
func (t *NumericLiteral) SQL() string
type OnDeleteAction ¶
type OnDeleteAction string
const ( OnDeleteCascade OnDeleteAction = "ON DELETE CASCADE" OnDeleteNoAction OnDeleteAction = "ON DELETE NO ACTION" )
type Options ¶
type Options struct { Options token.Pos // position of "OPTIONS" keyword Rparen token.Pos // position of ")" Records []*OptionsDef // len(Records) > 0 }
Options is generic OPTIONS clause node without key and value checking.
OPTIONS ({{.Records | sqlJoin ","}})
func (*Options) BoolField ¶
BoolField finds name in records, and return its value as *bool. If Options doesn't have a record with name, it returns FieldNotFound error. If record have NullLiteral value, it returns nil. If record have BoolLiteral value, it returns pointer of bool value. If record have value which is neither NullLiteral nor BoolLiteral, it returns error.
func (*Options) Field ¶
Field finds name in Records, and return its value as Expr. The second return value indicates that the name was found in Records. You should use other *Field methods if possible.
func (*Options) IntegerField ¶
IntegerField finds name in records, and return its value as *int64. If Options doesn't have a record with name, it returns FieldNotFound error. If record have NullLiteral value, it returns nil. If record have IntegerLiteral value, it returns pointer of int64 value. If record have value which is neither NullLiteral nor BoolLiteral, it returns error.
func (*Options) StringField ¶
StringField finds name in records, and return its value as *string. If Options doesn't have a record with name, it returns FieldNotFound error. If record have NullLiteral value, it returns nil. If record have StringLiteral value, it returns pointer of string value. If record have value which is neither NullLiteral nor StringLiteral, it returns error.
type OptionsDef ¶
OptionsDef is single option definition for DDL statements.
{{.Name | sql}} = {{.Value | sql}}
func (*OptionsDef) End ¶
func (o *OptionsDef) End() token.Pos
func (*OptionsDef) Pos ¶
func (o *OptionsDef) Pos() token.Pos
func (*OptionsDef) SQL ¶
func (g *OptionsDef) SQL() string
type OrderBy ¶
type OrderBy struct { Order token.Pos // position of "ORDER" keyword Items []*OrderByItem // len(Items) > 0 }
OrderBy is ORDER BY clause node.
ORDER BY {{.Items | sqlJoin ","}}
type OrderByItem ¶
type OrderByItem struct { DirPos token.Pos // position of Dir Expr Expr Collate *Collate // optional Dir Direction // optional }
OrderByItem is expression node in ORDER BY clause list.
{{.Expr | sql}} {{.Collate | sqlOpt}} {{.Direction}}
func (*OrderByItem) End ¶
func (o *OrderByItem) End() token.Pos
func (*OrderByItem) Pos ¶
func (o *OrderByItem) Pos() token.Pos
func (*OrderByItem) SQL ¶
func (o *OrderByItem) SQL() string
type ParenTableExpr ¶
type ParenTableExpr struct {
Lparen, Rparen token.Pos // position of "(" and ")"
Source TableExpr // SubQueryJoinExpr (without As) or Join
Sample *TableSample // optional
}
ParenTableExpr is parenthesized JOIN expression.
({{.Source | sql}}) {{.Sample | sqlOpt}}
func (*ParenTableExpr) End ¶
func (p *ParenTableExpr) End() token.Pos
func (*ParenTableExpr) Pos ¶
func (p *ParenTableExpr) Pos() token.Pos
func (*ParenTableExpr) SQL ¶
func (p *ParenTableExpr) SQL() string
type Path ¶
type Path struct {
Idents []*Ident // len(Idents) > 0
}
Path is dot-chained identifier list. It can be simple name without dot.
{{.Idents | sqlJoin "."}}
type PathTableExpr ¶
type PathTableExpr struct { Path *Path Hint *Hint // optional As *AsAlias // optional WithOffset *WithOffset // optional Sample *TableSample // optional }
PathTableExpr is path expression node in FROM clause. Parser cannot distinguish between `implicit UNNEST` and tables in a named schema. It is the job of a later phase to determine this distinction.
{{.Path | sql}} {{.Hint | sqlOpt}} {{.As | sqlOpt}} {{.Sample | sqlOpt}}
func (*PathTableExpr) End ¶
func (p *PathTableExpr) End() token.Pos
func (*PathTableExpr) Pos ¶
func (p *PathTableExpr) Pos() token.Pos
func (*PathTableExpr) SQL ¶
func (e *PathTableExpr) SQL() string
type PipeOperator ¶
type PipeOperator interface { Node // contains filtered or unexported methods }
PipeOperator represents pipe operator node which can be appeared in Query.
type PipeSelect ¶
type PipeSelect struct { Pipe token.Pos // position of "|>" AllOrDistinct AllOrDistinct // optional As SelectAs // optional Results []SelectItem // len(Results) > 0 }
PipeSelect is SELECT pipe operator node.
|> SELECT {{.AllOrDistinct}} {{.As | sqlOpt}} {{.Results | sqlJoin ", "}}
func (*PipeSelect) End ¶
func (p *PipeSelect) End() token.Pos
func (*PipeSelect) Pos ¶
func (p *PipeSelect) Pos() token.Pos
func (*PipeSelect) SQL ¶
func (p *PipeSelect) SQL() string
type PositionKeyword ¶
type PositionKeyword string
const ( PositionKeywordOffset PositionKeyword = "OFFSET" PositionKeywordSafeOffset PositionKeyword = "SAFE_OFFSET" PositionKeywordOrdinal PositionKeyword = "ORDINAL" PositionKeywordSafeOrdinal PositionKeyword = "SAFE_ORDINAL" )
type Privilege ¶
type Privilege interface { Node // contains filtered or unexported methods }
Privilege represents privileges specified by GRANT and REVOKE.
type PrivilegeOnTable ¶
type PrivilegeOnTable struct { Privileges []TablePrivilege // len(Privileges) > 0 Names []*Ident // len(Names) > 0 }
PrivilegeOnTable is ON TABLE privilege node in GRANT and REVOKE.
{{.Privileges | sqlJoin ","}} ON TABLE {{.Names | sqlJoin ","}}
func (*PrivilegeOnTable) End ¶
func (p *PrivilegeOnTable) End() token.Pos
func (*PrivilegeOnTable) Pos ¶
func (p *PrivilegeOnTable) Pos() token.Pos
func (*PrivilegeOnTable) SQL ¶
func (p *PrivilegeOnTable) SQL() string
type PropertyGraphColumnNameList ¶ added in v0.3.0
PropertyGraphColumnNameList represents one or more columns to assign to a key.
({{.ColumnNameList | sqlJoin ", "}})
func (*PropertyGraphColumnNameList) End ¶ added in v0.3.0
func (p *PropertyGraphColumnNameList) End() token.Pos
func (*PropertyGraphColumnNameList) Pos ¶ added in v0.3.0
func (p *PropertyGraphColumnNameList) Pos() token.Pos
func (*PropertyGraphColumnNameList) SQL ¶ added in v0.3.0
func (p *PropertyGraphColumnNameList) SQL() string
type PropertyGraphContent ¶ added in v0.3.0
type PropertyGraphContent struct { NodeTables *PropertyGraphNodeTables EdgeTables *PropertyGraphEdgeTables //optional }
PropertyGraphContent represents body of CREATE PROPERTY GRAPH statement.
NODE TABLES {{.NodeTables | sql}} {{.EdgeTables | sqlOpt}}
func (*PropertyGraphContent) End ¶ added in v0.3.0
func (p *PropertyGraphContent) End() token.Pos
func (*PropertyGraphContent) Pos ¶ added in v0.3.0
func (p *PropertyGraphContent) Pos() token.Pos
func (*PropertyGraphContent) SQL ¶ added in v0.3.0
func (p *PropertyGraphContent) SQL() string
type PropertyGraphDerivedProperty ¶ added in v0.3.0
PropertyGraphDerivedProperty represents an expression that defines a property and can optionally reference the input table columns.
{{.Expr | sql}} {{if .Alias}}AS {{.Alias | sql}}{{end}}
func (*PropertyGraphDerivedProperty) End ¶ added in v0.3.0
func (p *PropertyGraphDerivedProperty) End() token.Pos
func (*PropertyGraphDerivedProperty) Pos ¶ added in v0.3.0
func (p *PropertyGraphDerivedProperty) Pos() token.Pos
func (*PropertyGraphDerivedProperty) SQL ¶ added in v0.3.0
func (p *PropertyGraphDerivedProperty) SQL() string
type PropertyGraphDerivedPropertyList ¶ added in v0.3.0
type PropertyGraphDerivedPropertyList struct { Properties token.Pos // position of "PROPERTIES" Rparen token.Pos // position of ")" DerivedProperties []*PropertyGraphDerivedProperty // len(DerivedProperties) > 0 }
PropertyGraphDerivedPropertyList represents a list of PropertyGraphDerivedProperty. NOTE: In current syntax reference, "(" and ")" are missing.
PROPERTIES ({{.DerivedProperties | sqlJoin ", "}})
func (*PropertyGraphDerivedPropertyList) End ¶ added in v0.3.0
func (p *PropertyGraphDerivedPropertyList) End() token.Pos
func (*PropertyGraphDerivedPropertyList) Pos ¶ added in v0.3.0
func (p *PropertyGraphDerivedPropertyList) Pos() token.Pos
func (*PropertyGraphDerivedPropertyList) SQL ¶ added in v0.3.0
func (p *PropertyGraphDerivedPropertyList) SQL() string
type PropertyGraphDestinationKey ¶ added in v0.3.0
type PropertyGraphDestinationKey struct { Destination token.Pos Keys *PropertyGraphColumnNameList ElementReference *Ident ReferenceColumns *PropertyGraphColumnNameList // optional }
PropertyGraphDestinationKey represents the key for the destination node of the edge.
DESTINATION KEY {{.Keys | sql}} REFERENCES {{.ElementReference | sql}} {{.ReferenceColumns | sqlOpt}}
func (*PropertyGraphDestinationKey) End ¶ added in v0.3.0
func (p *PropertyGraphDestinationKey) End() token.Pos
func (*PropertyGraphDestinationKey) Pos ¶ added in v0.3.0
func (p *PropertyGraphDestinationKey) Pos() token.Pos
func (*PropertyGraphDestinationKey) SQL ¶ added in v0.3.0
func (p *PropertyGraphDestinationKey) SQL() string
type PropertyGraphEdgeElementKeys ¶ added in v0.3.0
type PropertyGraphEdgeElementKeys struct { Element *PropertyGraphElementKey // optional Source *PropertyGraphSourceKey Destination *PropertyGraphDestinationKey }
PropertyGraphEdgeElementKeys represents PropertyGraphSourceKey and PropertyGraphDestinationKey with optional PropertyGraphElementKey.
{{.Element | sqlOpt}} {{.Source | sql}} {{.Destination | sql}}
func (*PropertyGraphEdgeElementKeys) End ¶ added in v0.3.0
func (p *PropertyGraphEdgeElementKeys) End() token.Pos
func (*PropertyGraphEdgeElementKeys) Pos ¶ added in v0.3.0
func (p *PropertyGraphEdgeElementKeys) Pos() token.Pos
func (*PropertyGraphEdgeElementKeys) SQL ¶ added in v0.3.0
func (p *PropertyGraphEdgeElementKeys) SQL() string
type PropertyGraphEdgeTables ¶ added in v0.3.0
type PropertyGraphEdgeTables struct { Edge token.Pos Tables *PropertyGraphElementList }
PropertyGraphEdgeTables is EDGE TABLES node in CREATE PROPERTY GRAPH statement.
EDGE TABLES {{.Tables | sql}}
func (*PropertyGraphEdgeTables) End ¶ added in v0.3.0
func (p *PropertyGraphEdgeTables) End() token.Pos
func (*PropertyGraphEdgeTables) Pos ¶ added in v0.3.0
func (p *PropertyGraphEdgeTables) Pos() token.Pos
func (*PropertyGraphEdgeTables) SQL ¶ added in v0.3.0
func (p *PropertyGraphEdgeTables) SQL() string
type PropertyGraphElement ¶ added in v0.3.0
type PropertyGraphElement struct { Name *Ident Alias *Ident // optional Keys PropertyGraphElementKeys // optional Properties PropertyGraphLabelsOrProperties // optional }
PropertyGraphElement represents a single element in NODE TABLES or EDGE TABLES.
{{.Name | sql}} {{if .Alias | isnil | not)}}AS {{.Alias | sql}}{{end}} {{.Keys | sqlOpt}} {{.Properties | sqlOpt}}
func (*PropertyGraphElement) End ¶ added in v0.3.0
func (p *PropertyGraphElement) End() token.Pos
func (*PropertyGraphElement) Pos ¶ added in v0.3.0
func (p *PropertyGraphElement) Pos() token.Pos
func (*PropertyGraphElement) SQL ¶ added in v0.3.0
func (p *PropertyGraphElement) SQL() string
type PropertyGraphElementKey ¶ added in v0.3.0
type PropertyGraphElementKey struct { Key token.Pos Keys *PropertyGraphColumnNameList }
PropertyGraphElementKey represents the key that identifies the node or edge element.
KEY {{.Keys | sql}}
func (*PropertyGraphElementKey) End ¶ added in v0.3.0
func (p *PropertyGraphElementKey) End() token.Pos
func (*PropertyGraphElementKey) Pos ¶ added in v0.3.0
func (p *PropertyGraphElementKey) Pos() token.Pos
func (*PropertyGraphElementKey) SQL ¶ added in v0.3.0
func (p *PropertyGraphElementKey) SQL() string
type PropertyGraphElementKeys ¶ added in v0.3.0
type PropertyGraphElementKeys interface { Node // contains filtered or unexported methods }
PropertyGraphElementKeys represents PropertyGraphNodeElementKey or PropertyGraphEdgeElementKeys.
type PropertyGraphElementLabel ¶ added in v0.3.0
type PropertyGraphElementLabel interface { Node // contains filtered or unexported methods }
PropertyGraphElementLabel represents a element label definition.
type PropertyGraphElementLabelDefaultLabel ¶ added in v0.3.0
PropertyGraphElementLabelDefaultLabel represents DEFAULT LABEL node.
DEFAULT LABEL
func (*PropertyGraphElementLabelDefaultLabel) End ¶ added in v0.3.0
func (p *PropertyGraphElementLabelDefaultLabel) End() token.Pos
func (*PropertyGraphElementLabelDefaultLabel) Pos ¶ added in v0.3.0
func (p *PropertyGraphElementLabelDefaultLabel) Pos() token.Pos
func (*PropertyGraphElementLabelDefaultLabel) SQL ¶ added in v0.3.0
func (p *PropertyGraphElementLabelDefaultLabel) SQL() string
type PropertyGraphElementLabelLabelName ¶ added in v0.3.0
PropertyGraphElementLabelLabelName represents LABEL label_name node.
LABEL {{.Name | sql}}
func (*PropertyGraphElementLabelLabelName) End ¶ added in v0.3.0
func (p *PropertyGraphElementLabelLabelName) End() token.Pos
func (*PropertyGraphElementLabelLabelName) Pos ¶ added in v0.3.0
func (p *PropertyGraphElementLabelLabelName) Pos() token.Pos
func (*PropertyGraphElementLabelLabelName) SQL ¶ added in v0.3.0
func (p *PropertyGraphElementLabelLabelName) SQL() string
type PropertyGraphElementList ¶ added in v0.3.0
type PropertyGraphElementList struct {
Lparen, Rparen token.Pos
Elements []*PropertyGraphElement
}
PropertyGraphElementList represents element list in NODE TABLES or EDGE TABLES.
({{.Elements | sqlJoin ", "}})
func (*PropertyGraphElementList) End ¶ added in v0.3.0
func (p *PropertyGraphElementList) End() token.Pos
func (*PropertyGraphElementList) Pos ¶ added in v0.3.0
func (p *PropertyGraphElementList) Pos() token.Pos
func (*PropertyGraphElementList) SQL ¶ added in v0.3.0
func (p *PropertyGraphElementList) SQL() string
type PropertyGraphElementProperties ¶ added in v0.3.0
type PropertyGraphElementProperties interface { Node // contains filtered or unexported methods }
PropertyGraphElementProperties represents a definition of properties. See https://cloud.google.com/spanner/docs/reference/standard-sql/graph-schema-statements#element_table_property_definition.
type PropertyGraphLabelAndProperties ¶ added in v0.3.0
type PropertyGraphLabelAndProperties struct { Label PropertyGraphElementLabel Properties PropertyGraphElementProperties // optional }
PropertyGraphLabelAndProperties represents label and properties definition for a single label.
{{.Label | sql}} {{.Properties | sqlOpt}}
func (*PropertyGraphLabelAndProperties) End ¶ added in v0.3.0
func (p *PropertyGraphLabelAndProperties) End() token.Pos
func (*PropertyGraphLabelAndProperties) Pos ¶ added in v0.3.0
func (p *PropertyGraphLabelAndProperties) Pos() token.Pos
func (*PropertyGraphLabelAndProperties) SQL ¶ added in v0.3.0
func (p *PropertyGraphLabelAndProperties) SQL() string
type PropertyGraphLabelAndPropertiesList ¶ added in v0.3.0
type PropertyGraphLabelAndPropertiesList struct {
LabelAndProperties []*PropertyGraphLabelAndProperties // len(LabelAndProperties) > 0
}
PropertyGraphLabelAndPropertiesList represents whitespace-separated list of PropertyGraphLabelAndProperties. It implements PropertyGraphLabelsOrProperties.
{{.LabelAndProperties | sqlJoin " "}}
func (*PropertyGraphLabelAndPropertiesList) End ¶ added in v0.3.0
func (p *PropertyGraphLabelAndPropertiesList) End() token.Pos
func (*PropertyGraphLabelAndPropertiesList) Pos ¶ added in v0.3.0
func (p *PropertyGraphLabelAndPropertiesList) Pos() token.Pos
func (*PropertyGraphLabelAndPropertiesList) SQL ¶ added in v0.3.0
func (p *PropertyGraphLabelAndPropertiesList) SQL() string
type PropertyGraphLabelsOrProperties ¶ added in v0.3.0
type PropertyGraphLabelsOrProperties interface { Node // contains filtered or unexported methods }
PropertyGraphLabelsOrProperties represents labels with properties or a single properties of node or edge.
type PropertyGraphNoProperties ¶ added in v0.3.0
type PropertyGraphNoProperties struct {
No, Properties token.Pos // position of "NO" and "PROPERTIES"
}
PropertyGraphNoProperties represents the element doesn't have properties.
NO PROPERTIES
func (*PropertyGraphNoProperties) End ¶ added in v0.3.0
func (p *PropertyGraphNoProperties) End() token.Pos
func (*PropertyGraphNoProperties) Pos ¶ added in v0.3.0
func (p *PropertyGraphNoProperties) Pos() token.Pos
func (*PropertyGraphNoProperties) SQL ¶ added in v0.3.0
func (p *PropertyGraphNoProperties) SQL() string
type PropertyGraphNodeElementKey ¶ added in v0.3.0
type PropertyGraphNodeElementKey struct {
Key *PropertyGraphElementKey
}
PropertyGraphNodeElementKey is a wrapper of PropertyGraphElementKey to implement PropertyGraphElementKeys without deeper AST hierarchy.
{{.Key | sql}}
func (*PropertyGraphNodeElementKey) End ¶ added in v0.3.0
func (p *PropertyGraphNodeElementKey) End() token.Pos
func (*PropertyGraphNodeElementKey) Pos ¶ added in v0.3.0
func (p *PropertyGraphNodeElementKey) Pos() token.Pos
func (*PropertyGraphNodeElementKey) SQL ¶ added in v0.3.0
func (p *PropertyGraphNodeElementKey) SQL() string
type PropertyGraphNodeTables ¶ added in v0.3.0
type PropertyGraphNodeTables struct { Node token.Pos Tables *PropertyGraphElementList }
PropertyGraphNodeTables is NODE TABLES node in CREATE PROPERTY GRAPH statement.
NODE TABLES {{.Tables | sql}}
func (*PropertyGraphNodeTables) End ¶ added in v0.3.0
func (p *PropertyGraphNodeTables) End() token.Pos
func (*PropertyGraphNodeTables) Pos ¶ added in v0.3.0
func (p *PropertyGraphNodeTables) Pos() token.Pos
func (*PropertyGraphNodeTables) SQL ¶ added in v0.3.0
func (p *PropertyGraphNodeTables) SQL() string
type PropertyGraphPropertiesAre ¶ added in v0.3.0
type PropertyGraphPropertiesAre struct { Properties token.Pos // position of "PROPERTIES" Columns token.Pos // position of "COLUMNS" ExceptColumns *PropertyGraphColumnNameList // optional }
PropertyGraphPropertiesAre defines which columns to include as element properties.
PROPERTIES ARE ALL COLUMNS{{if .ExceptColumns | isnil | not}} EXCEPT {{.ExceptColumns | sql}}{{end}}
func (*PropertyGraphPropertiesAre) End ¶ added in v0.3.0
func (p *PropertyGraphPropertiesAre) End() token.Pos
func (*PropertyGraphPropertiesAre) Pos ¶ added in v0.3.0
func (p *PropertyGraphPropertiesAre) Pos() token.Pos
func (*PropertyGraphPropertiesAre) SQL ¶ added in v0.3.0
func (p *PropertyGraphPropertiesAre) SQL() string
type PropertyGraphSingleProperties ¶ added in v0.3.0
type PropertyGraphSingleProperties struct {
Properties PropertyGraphElementProperties
}
PropertyGraphSingleProperties is wrapper node for PropertyGraphElementProperties in PropertyGraphElement. It implements PropertyGraphLabelsOrProperties.
{{.Properties | sql}}
func (*PropertyGraphSingleProperties) End ¶ added in v0.3.0
func (p *PropertyGraphSingleProperties) End() token.Pos
func (*PropertyGraphSingleProperties) Pos ¶ added in v0.3.0
func (p *PropertyGraphSingleProperties) Pos() token.Pos
func (*PropertyGraphSingleProperties) SQL ¶ added in v0.3.0
func (p *PropertyGraphSingleProperties) SQL() string
type PropertyGraphSourceKey ¶ added in v0.3.0
type PropertyGraphSourceKey struct { Source token.Pos Keys *PropertyGraphColumnNameList ElementReference *Ident ReferenceColumns *PropertyGraphColumnNameList // optional }
PropertyGraphSourceKey represents the key for the source node of the edge.
SOURCE KEY {{.Keys | sql}} REFERENCES {{.ElementReference | sql}} {{.ReferenceColumns | sqlOpt}}
func (*PropertyGraphSourceKey) End ¶ added in v0.3.0
func (p *PropertyGraphSourceKey) End() token.Pos
func (*PropertyGraphSourceKey) Pos ¶ added in v0.3.0
func (p *PropertyGraphSourceKey) Pos() token.Pos
func (*PropertyGraphSourceKey) SQL ¶ added in v0.3.0
func (p *PropertyGraphSourceKey) SQL() string
type ProtoBundleTypes ¶
ProtoBundleTypes is parenthesized Protocol Buffers type names node IN CREATE/ALTER PROTO BUNDLE statement.
({{.Types | sqlJoin ", "}})
func (*ProtoBundleTypes) End ¶
func (p *ProtoBundleTypes) End() token.Pos
func (*ProtoBundleTypes) Pos ¶
func (p *ProtoBundleTypes) Pos() token.Pos
func (*ProtoBundleTypes) SQL ¶
func (p *ProtoBundleTypes) SQL() string
type Query ¶
type Query struct { With *With Query QueryExpr OrderBy *OrderBy // optional Limit *Limit // optional ForUpdate *ForUpdate // optional PipeOperators []PipeOperator }
Query is query expression node with optional CTE, ORDER BY, LIMIT, and pipe operators. Usually, it is used as outermost QueryExpr in SubQuery and QueryStatement
{{.With | sqlOpt}} {{.Query | sql}} {{.OrderBy | sqlOpt}} {{.Limit | sqlOpt}} {{.PipeOperators | sqlJoin ", "}}
type QueryExpr ¶
type QueryExpr interface { Node // contains filtered or unexported methods }
QueryExpr represents query expression, which can be body of QueryStatement or subqueries. Select and FromQuery are leaf QueryExpr and others wrap other QueryExpr.
type QueryStatement ¶
QueryStatement is query statement node.
{{.Hint | sqlOpt}} {{.Query | sql}}
func (*QueryStatement) End ¶
func (q *QueryStatement) End() token.Pos
func (*QueryStatement) Pos ¶
func (q *QueryStatement) Pos() token.Pos
func (*QueryStatement) SQL ¶
func (q *QueryStatement) SQL() string
type RenameTable ¶
type RenameTable struct { Rename token.Pos // position of "RENAME" pseudo keyword Tos []*RenameTableTo // len(Tos) > 0 }
RenameTable is RENAME TABLE statement node.
RENAME TABLE {{.Tos | sqlJoin ", "}}
func (*RenameTable) End ¶
func (r *RenameTable) End() token.Pos
func (*RenameTable) Pos ¶
func (r *RenameTable) Pos() token.Pos
func (*RenameTable) SQL ¶
func (r *RenameTable) SQL() string
type RenameTableTo ¶
RenameTableTo is old TO new node in RENAME TABLE statement.
{{.Old | sql}} TO {{.New | sql}}
func (*RenameTableTo) End ¶
func (r *RenameTableTo) End() token.Pos
func (*RenameTableTo) Pos ¶
func (r *RenameTableTo) Pos() token.Pos
func (*RenameTableTo) SQL ¶
func (r *RenameTableTo) SQL() string
type RenameTo ¶
type RenameTo struct { Rename token.Pos // position of "RENAME" pseudo keyword Name *Ident AddSynonym *AddSynonym // optional }
RenameTo is RENAME TO node in ALTER TABLE.
RENAME TO {{.Name | sql}}{{if .AddSynonym}}, {{.AddSynonym | sql}}{{end}}
type ReplaceFieldsArg ¶
ReplaceFieldsArg is value AS field_path node in ReplaceFieldsExpr.
{{.Expr | sql}} AS {{.Field | sql}}
func (*ReplaceFieldsArg) End ¶
func (r *ReplaceFieldsArg) End() token.Pos
func (*ReplaceFieldsArg) Pos ¶
func (r *ReplaceFieldsArg) Pos() token.Pos
func (*ReplaceFieldsArg) SQL ¶
func (r *ReplaceFieldsArg) SQL() string
type ReplaceFieldsExpr ¶
type ReplaceFieldsExpr struct { ReplaceFields token.Pos // position of "REPLACE_FIELDS" keyword Rparen token.Pos // position of ")" Expr Expr Fields []*ReplaceFieldsArg }
ReplaceFieldsExpr is REPLACE_FIELDS call expression node.
REPLACE_FIELDS({{.Expr.| sql}}, {{.Fields | sqlJoin ", "}})
func (*ReplaceFieldsExpr) End ¶
func (r *ReplaceFieldsExpr) End() token.Pos
func (*ReplaceFieldsExpr) Pos ¶
func (r *ReplaceFieldsExpr) Pos() token.Pos
func (*ReplaceFieldsExpr) SQL ¶
func (r *ReplaceFieldsExpr) SQL() string
type ReplaceRowDeletionPolicy ¶
type ReplaceRowDeletionPolicy struct { Replace token.Pos // position of "REPLACE" keyword RowDeletionPolicy *RowDeletionPolicy }
ReplaceRowDeletionPolicy is REPLACE ROW DELETION POLICY clause in ALTER TABLE.
REPLACE {{.RowDeletionPolicy}}
func (*ReplaceRowDeletionPolicy) End ¶
func (r *ReplaceRowDeletionPolicy) End() token.Pos
func (*ReplaceRowDeletionPolicy) Pos ¶
func (r *ReplaceRowDeletionPolicy) Pos() token.Pos
func (*ReplaceRowDeletionPolicy) SQL ¶
func (r *ReplaceRowDeletionPolicy) SQL() string
type RespectNulls ¶
RespectNulls represents RESPECT NULLS of aggregate function calls
RESPECT NULLS
func (*RespectNulls) End ¶
func (r *RespectNulls) End() token.Pos
func (*RespectNulls) Pos ¶
func (r *RespectNulls) Pos() token.Pos
func (*RespectNulls) SQL ¶
func (r *RespectNulls) SQL() string
type RestartCounterWith ¶
type RestartCounterWith struct { Restart token.Pos // position of "RESTART" keyword Counter *IntLiteral }
RestartCounterWith is RESTART COUNTER WITH node.
RESTART COUNTER WITH {{.Counter | sql}}
func (*RestartCounterWith) End ¶
func (r *RestartCounterWith) End() token.Pos
func (*RestartCounterWith) Pos ¶
func (r *RestartCounterWith) Pos() token.Pos
func (*RestartCounterWith) SQL ¶
func (r *RestartCounterWith) SQL() string
type Revoke ¶
type Revoke struct { Revoke token.Pos // position of "REVOKE" keyword Privilege Privilege // len(Privileges) > 0 Roles []*Ident // len(Roles) > 0 }
Revoke is REVOKE statement node.
REVOKE {{.Privilege | sql}} FROM ROLE {{.Roles | sqlJoin ","}}
type RolePrivilege ¶
RolePrivilege is ROLE privilege node in GRANT and REVOKE.
ROLE {{.Names | sqlJoin ","}}
func (*RolePrivilege) End ¶
func (r *RolePrivilege) End() token.Pos
func (*RolePrivilege) Pos ¶
func (r *RolePrivilege) Pos() token.Pos
func (*RolePrivilege) SQL ¶
func (r *RolePrivilege) SQL() string
type RowDeletionPolicy ¶
type RowDeletionPolicy struct { Row token.Pos // position of "ROW" Rparen token.Pos // position of ")" ColumnName *Ident NumDays *IntLiteral }
RowDeletionPolicy is ROW DELETION POLICY clause.
ROW DELETION POLICY (OLDER_THAN({{.ColymnName | sql}}, INTERVAL {{.NumDays}} DAY))
func (*RowDeletionPolicy) End ¶
func (r *RowDeletionPolicy) End() token.Pos
func (*RowDeletionPolicy) Pos ¶
func (r *RowDeletionPolicy) Pos() token.Pos
func (*RowDeletionPolicy) SQL ¶
func (r *RowDeletionPolicy) SQL() string
type ScalarSchemaType ¶
type ScalarSchemaType struct { NamePos token.Pos // position of this name Name ScalarTypeName // except for StringTypeName and BytesTypeName }
ScalarSchemaType is scalar type node in schema.
{{.Name}}
func (*ScalarSchemaType) End ¶
func (s *ScalarSchemaType) End() token.Pos
func (*ScalarSchemaType) Pos ¶
func (s *ScalarSchemaType) Pos() token.Pos
func (*ScalarSchemaType) SQL ¶
func (s *ScalarSchemaType) SQL() string
type ScalarSubQuery ¶
ScalarSubQuery is subquery in expression.
({{.Query | sql}})
func (*ScalarSubQuery) End ¶
func (s *ScalarSubQuery) End() token.Pos
func (*ScalarSubQuery) Pos ¶
func (s *ScalarSubQuery) Pos() token.Pos
func (*ScalarSubQuery) SQL ¶
func (s *ScalarSubQuery) SQL() string
type ScalarTypeName ¶
type ScalarTypeName string
const ( BoolTypeName ScalarTypeName = "BOOL" Int64TypeName ScalarTypeName = "INT64" Float32TypeName ScalarTypeName = "FLOAT32" Float64TypeName ScalarTypeName = "FLOAT64" StringTypeName ScalarTypeName = "STRING" BytesTypeName ScalarTypeName = "BYTES" DateTypeName ScalarTypeName = "DATE" TimestampTypeName ScalarTypeName = "TIMESTAMP" NumericTypeName ScalarTypeName = "NUMERIC" JSONTypeName ScalarTypeName = "JSON" TokenListTypeName ScalarTypeName = "TOKENLIST" )
type SchemaType ¶
type SchemaType interface { Node // contains filtered or unexported methods }
SchemaType represents types for schema.
type SecurityType ¶
type SecurityType string
const ( SecurityTypeInvoker SecurityType = "INVOKER" SecurityTypeDefiner SecurityType = "DEFINER" )
type Select ¶
type Select struct { Select token.Pos // position of "select" keyword AllOrDistinct AllOrDistinct // optional As SelectAs // optional Results []SelectItem // len(Results) > 0 From *From // optional Where *Where // optional GroupBy *GroupBy // optional Having *Having // optional }
Select is SELECT statement node.
SELECT {{.AllOrDistinct}} {{.As | sqlOpt}} {{.Results | sqlJoin ","}} {{.From | sqlOpt}} {{.Where | sqlOpt}} {{.GroupBy | sqlOpt}} {{.Having | sqlOpt}}
type SelectAs ¶
type SelectAs interface { Node // contains filtered or unexported methods }
SelectAs represents AS VALUE/STRUCT/typename clause in SELECT clause.
type SelectItem ¶
type SelectItem interface { Node // contains filtered or unexported methods }
SelectItem represents expression in SELECT clause result columns list.
type SelectPrivilege ¶
type SelectPrivilege struct { Select token.Pos // position of "SELECT" keyword Rparen token.Pos // position of ")" when len(Columns) > 0 Columns []*Ident }
SelectPrivilege is SELECT ON TABLE privilege node in GRANT and REVOKE.
SELECT{{if .Columns}}({{.Columns | sqlJoin ","}}){{end}}
func (*SelectPrivilege) End ¶
func (s *SelectPrivilege) End() token.Pos
func (*SelectPrivilege) Pos ¶
func (s *SelectPrivilege) Pos() token.Pos
func (*SelectPrivilege) SQL ¶
func (s *SelectPrivilege) SQL() string
type SelectPrivilegeOnChangeStream ¶
SelectPrivilegeOnChangeStream is SELECT ON CHANGE STREAM privilege node in GRANT and REVOKE.
SELECT ON CHANGE STREAM {{.Names | sqlJoin ", "}}
func (*SelectPrivilegeOnChangeStream) End ¶
func (s *SelectPrivilegeOnChangeStream) End() token.Pos
func (*SelectPrivilegeOnChangeStream) Pos ¶
func (s *SelectPrivilegeOnChangeStream) Pos() token.Pos
func (*SelectPrivilegeOnChangeStream) SQL ¶
func (p *SelectPrivilegeOnChangeStream) SQL() string
type SelectPrivilegeOnView ¶
SelectPrivilegeOnView is SELECT ON VIEW privilege node in GRANT and REVOKE.
SELECT ON VIEW {{.Names | sqlJoin ","}}
func (*SelectPrivilegeOnView) End ¶
func (s *SelectPrivilegeOnView) End() token.Pos
func (*SelectPrivilegeOnView) Pos ¶
func (s *SelectPrivilegeOnView) Pos() token.Pos
func (*SelectPrivilegeOnView) SQL ¶
func (s *SelectPrivilegeOnView) SQL() string
type SelectorExpr ¶
SelectorExpr is struct field access expression node.
{{.Expr | sql}}.{{.Ident | sql}}
func (*SelectorExpr) End ¶
func (s *SelectorExpr) End() token.Pos
func (*SelectorExpr) Pos ¶
func (s *SelectorExpr) Pos() token.Pos
func (*SelectorExpr) SQL ¶
func (s *SelectorExpr) SQL() string
type SequenceArg ¶
SequenceArg is argument of sequence function call.
SEQUENCE {{.Expr | sql}}
func (*SequenceArg) End ¶
func (s *SequenceArg) End() token.Pos
func (*SequenceArg) Pos ¶
func (s *SequenceArg) Pos() token.Pos
func (*SequenceArg) SQL ¶
func (s *SequenceArg) SQL() string
type SequenceParam ¶
type SequenceParam interface { Node // contains filtered or unexported methods }
type SetNoSkipRange ¶
type SetNoSkipRange struct { Set token.Pos NoSkipRange *NoSkipRange }
SetNoSkipRange is SET NO SKIP RANGE node.
SET {{.NoSkipRange | sql}}
func (*SetNoSkipRange) End ¶
func (s *SetNoSkipRange) End() token.Pos
func (*SetNoSkipRange) Pos ¶
func (s *SetNoSkipRange) Pos() token.Pos
func (*SetNoSkipRange) SQL ¶
func (s *SetNoSkipRange) SQL() string
type SetOnDelete ¶
type SetOnDelete struct { Set token.Pos // position of "SET" keyword OnDeleteEnd token.Pos // end position of ON DELETE clause OnDelete OnDeleteAction }
SetOnDelete is SET ON DELETE clause in ALTER TABLE.
SET ON DELETE {{.OnDelete}}
func (*SetOnDelete) End ¶
func (s *SetOnDelete) End() token.Pos
func (*SetOnDelete) Pos ¶
func (s *SetOnDelete) Pos() token.Pos
func (*SetOnDelete) SQL ¶
func (s *SetOnDelete) SQL() string
type SetSkipRange ¶
SetSkipRange is SET SKIP RANGE node
SET {{.SkipRange | sql}}
func (*SetSkipRange) End ¶
func (s *SetSkipRange) End() token.Pos
func (*SetSkipRange) Pos ¶
func (s *SetSkipRange) Pos() token.Pos
func (*SetSkipRange) SQL ¶
func (s *SetSkipRange) SQL() string
type SimpleType ¶
type SimpleType struct { NamePos token.Pos // position of this name Name ScalarTypeName }
SimpleType is type node having no parameter like INT64, STRING.
{{.Name}}
func (*SimpleType) End ¶
func (s *SimpleType) End() token.Pos
func (*SimpleType) Pos ¶
func (s *SimpleType) Pos() token.Pos
func (*SimpleType) SQL ¶
func (s *SimpleType) SQL() string
type SizedSchemaType ¶
type SizedSchemaType struct { NamePos token.Pos // position of this name Rparen token.Pos // position of ")" Name ScalarTypeName // StringTypeName or BytesTypeName // either Max or Size must be set Max bool Size IntValue }
SizedSchemaType is sized type node in schema.
{{.Name}}({{if .Max}}MAX{{else}}{{.Size | sql}}{{end}})
func (*SizedSchemaType) End ¶
func (s *SizedSchemaType) End() token.Pos
func (*SizedSchemaType) Pos ¶
func (s *SizedSchemaType) Pos() token.Pos
func (*SizedSchemaType) SQL ¶
func (s *SizedSchemaType) SQL() string
type SkipRange ¶
type SkipRange struct { Skip token.Pos // position of "SKIP" keyword Min, Max *IntLiteral }
SkipRange is SKIP RANGE node.
SKIP RANGE {{.Min | sql}}, {{.Max | sql}}
type Star ¶
type Star struct { Star token.Pos // position of "*" Except *StarModifierExcept // optional Replace *StarModifierReplace // optional }
Star is a single * in SELECT result columns list.
{{"*"}} {{.Except | sqlOpt}} {{.Replace | sqlOpt}}
Note: The text/template notation escapes * to avoid normalize * to - by some formatters because the prefix * is ambiguous with bulletin list.
type StarModifierExcept ¶
StarModifierExcept is EXCEPT node in Star and DotStar of SelectItem.
EXCEPT ({{Columns | sqlJoin ", "}})
func (*StarModifierExcept) End ¶
func (s *StarModifierExcept) End() token.Pos
func (*StarModifierExcept) Pos ¶
func (s *StarModifierExcept) Pos() token.Pos
func (*StarModifierExcept) SQL ¶
func (s *StarModifierExcept) SQL() string
type StarModifierReplace ¶
type StarModifierReplace struct { Replace token.Pos Rparen token.Pos Columns []*StarModifierReplaceItem }
StarModifierReplace is REPLACE node in Star and DotStar of SelectItem.
REPLACE ({{Columns | sqlJoin ", "}})
func (*StarModifierReplace) End ¶
func (s *StarModifierReplace) End() token.Pos
func (*StarModifierReplace) Pos ¶
func (s *StarModifierReplace) Pos() token.Pos
func (*StarModifierReplace) SQL ¶
func (s *StarModifierReplace) SQL() string
type StarModifierReplaceItem ¶
StarModifierReplaceItem is a single item of StarModifierReplace.
{{.Expr | sql}} AS {{.Name | sql}}
func (*StarModifierReplaceItem) End ¶
func (s *StarModifierReplaceItem) End() token.Pos
func (*StarModifierReplaceItem) Pos ¶
func (s *StarModifierReplaceItem) Pos() token.Pos
func (*StarModifierReplaceItem) SQL ¶
func (s *StarModifierReplaceItem) SQL() string
type StartCounterWith ¶
type StartCounterWith struct { Start token.Pos // position of "START" keyword Counter *IntLiteral }
StartCounterWith is START COUNTER WITH node.
START COUNTER WITH {{.Counter | sql}}
func (*StartCounterWith) End ¶
func (s *StartCounterWith) End() token.Pos
func (*StartCounterWith) Pos ¶
func (s *StartCounterWith) Pos() token.Pos
func (*StartCounterWith) SQL ¶
func (s *StartCounterWith) SQL() string
type Statement ¶
type Statement interface { Node // contains filtered or unexported methods }
Statement represents toplevel statement node of Spanner SQL.
type Storing ¶
type Storing struct { Storing token.Pos // position of "STORING" keyword Rparen token.Pos // position of ")" Columns []*Ident }
Storing is STORING clause in CREATE INDEX.
STORING ({{.Columns | sqlJoin ","}})
type StringLiteral ¶
StringLiteral is string literal node.
{{.Value | sqlStringQuote}}
func (*StringLiteral) End ¶
func (s *StringLiteral) End() token.Pos
func (*StringLiteral) Pos ¶
func (s *StringLiteral) Pos() token.Pos
func (*StringLiteral) SQL ¶
func (s *StringLiteral) SQL() string
type StringValue ¶
type StringValue interface { Node // contains filtered or unexported methods }
StringValue represents string value in SQL.
type StructField ¶
StructField is field in struct type node.
{{if .Ident}}{{.Ident | sql}}{{end}} {{.Type | sql}}
func (*StructField) End ¶
func (s *StructField) End() token.Pos
func (*StructField) Pos ¶
func (s *StructField) Pos() token.Pos
func (*StructField) SQL ¶
func (f *StructField) SQL() string
type StructType ¶
type StructType struct { Struct token.Pos // position of "STRUCT" Gt token.Pos // position of ">" Fields []*StructField }
StructType is struct type node.
STRUCT<{{.Fields | sqlJoin ","}}>
func (*StructType) End ¶
func (s *StructType) End() token.Pos
func (*StructType) Pos ¶
func (s *StructType) Pos() token.Pos
func (*StructType) SQL ¶
func (s *StructType) SQL() string
type SubQuery ¶
SubQuery is parenthesized query expression node. Note: subquery expression is expressed as a ParenTableExpr. Maybe better to rename as like ParenQueryExpr?
({{.Query | sql}})
type SubQueryInCondition ¶
type SubQueryInCondition struct {
Lparen, Rparen token.Pos // position of "(" and ")"
Query QueryExpr
}
SubQueryInCondition is subquery at IN condition.
({{.Query | sql}})
func (*SubQueryInCondition) End ¶
func (s *SubQueryInCondition) End() token.Pos
func (*SubQueryInCondition) Pos ¶
func (s *SubQueryInCondition) Pos() token.Pos
func (*SubQueryInCondition) SQL ¶
func (s *SubQueryInCondition) SQL() string
type SubQueryInput ¶
type SubQueryInput struct {
Query QueryExpr
}
SubQueryInput is query clause in INSERT.
{{.Query | sql}}
func (*SubQueryInput) End ¶
func (s *SubQueryInput) End() token.Pos
func (*SubQueryInput) Pos ¶
func (s *SubQueryInput) Pos() token.Pos
func (*SubQueryInput) SQL ¶
func (s *SubQueryInput) SQL() string
type SubQueryTableExpr ¶
type SubQueryTableExpr struct {
Lparen, Rparen token.Pos // position of "(" and ")"
Query QueryExpr
As *AsAlias // optional
Sample *TableSample // optional
}
SubQueryTableExpr is subquery inside JOIN expression.
({{.Query | sql}}) {{.As | sqlOpt}} {{.Sample | sqlOpt}}
func (*SubQueryTableExpr) End ¶
func (s *SubQueryTableExpr) End() token.Pos
func (*SubQueryTableExpr) Pos ¶
func (s *SubQueryTableExpr) Pos() token.Pos
func (*SubQueryTableExpr) SQL ¶
func (s *SubQueryTableExpr) SQL() string
type SubscriptSpecifier ¶
type SubscriptSpecifier interface { Node // contains filtered or unexported methods }
SubscriptSpecifier represents specifier of subscript operators.
type SubscriptSpecifierKeyword ¶
type SubscriptSpecifierKeyword struct { KeywordPos token.Pos // position of Keyword Rparen token.Pos // position of ")" Keyword PositionKeyword Expr Expr }
SubscriptSpecifierKeyword is subscript specifier with position keyword.
{{string(.Keyword)}}({{.Expr | sql}})
func (*SubscriptSpecifierKeyword) End ¶
func (s *SubscriptSpecifierKeyword) End() token.Pos
func (*SubscriptSpecifierKeyword) Pos ¶
func (s *SubscriptSpecifierKeyword) Pos() token.Pos
func (*SubscriptSpecifierKeyword) SQL ¶
func (s *SubscriptSpecifierKeyword) SQL() string
type Synonym ¶
type Synonym struct { Synonym token.Pos // position of "SYNONYM" pseudo keyword Rparen token.Pos // position of ")" Name *Ident }
Synonym is SYNONYM node in CREATE TABLE
SYNONYM ({.Name | sql})
type TVFCallExpr ¶
type TVFCallExpr struct { Rparen token.Pos // position of ")" Name *Path Args []TVFArg NamedArgs []*NamedArg Hint *Hint // optional Sample *TableSample // optional }
TVFCallExpr is table-valued function call expression node.
{{.Name | sql}}( {{.Args | sqlJoin ", "}} {{if len(.Args) > 0 && len(.NamedArgs) > 0}}, {{end}} {{.NamedArgs | sqlJoin ", "}} ) {{.Hint | sqlOpt}} {{.Sample | sqlOpt}}
func (*TVFCallExpr) End ¶
func (t *TVFCallExpr) End() token.Pos
func (*TVFCallExpr) Pos ¶
func (t *TVFCallExpr) Pos() token.Pos
func (*TVFCallExpr) SQL ¶
func (c *TVFCallExpr) SQL() string
type TableAlteration ¶
type TableAlteration interface { Node // contains filtered or unexported methods }
TableAlteration represents ALTER TABLE action.
type TableArg ¶
TableArg is TABLE table_name argument of table valued function call.
TABLE {{.Name | sql}}
type TableConstraint ¶
type TableConstraint struct { ConstraintPos token.Pos // position of "CONSTRAINT" keyword when Name presents Name *Ident // optional Constraint Constraint }
TableConstraint is table constraint in CREATE TABLE and ALTER TABLE.
{{if .Name}}CONSTRAINT {{.Name}}{{end}}{{.Constraint | sql}}
func (*TableConstraint) End ¶
func (t *TableConstraint) End() token.Pos
func (*TableConstraint) Pos ¶
func (t *TableConstraint) Pos() token.Pos
func (*TableConstraint) SQL ¶
func (c *TableConstraint) SQL() string
type TableExpr ¶
type TableExpr interface { Node // contains filtered or unexported methods }
TableExpr represents JOIN operands.
type TableName ¶
type TableName struct { Table *Ident Hint *Hint // optional As *AsAlias // optional Sample *TableSample // optional }
TableName is table name node in FROM clause.
{{.Table | sql}} {{.Hint | sqlOpt}} {{.As | sqlOpt}} {{.Sample | sqlOpt}}
type TablePrivilege ¶
type TablePrivilege interface { Node // contains filtered or unexported methods }
TablePrivilege represents privileges on table.
type TableSample ¶
type TableSample struct { TableSample token.Pos // position of "TABLESAMPLE" keyword Method TableSampleMethod Size *TableSampleSize }
TableSample is TABLESAMPLE clause node.
TABLESAMPLE {{.Method}} {{.Size | sql}}
func (*TableSample) End ¶
func (t *TableSample) End() token.Pos
func (*TableSample) Pos ¶
func (t *TableSample) Pos() token.Pos
func (*TableSample) SQL ¶
func (t *TableSample) SQL() string
type TableSampleMethod ¶
type TableSampleMethod string
const ( BernoulliSampleMethod TableSampleMethod = "BERNOULLI" ReservoirSampleMethod TableSampleMethod = "RESERVOIR" )
type TableSampleSize ¶
type TableSampleSize struct {
Lparen, Rparen token.Pos // position of "(" and ")"
Value NumValue
Unit TableSampleUnit
}
TableSampleSize is size part of TABLESAMPLE clause.
({{.Value | sql}} {{.Unit}})
func (*TableSampleSize) End ¶
func (t *TableSampleSize) End() token.Pos
func (*TableSampleSize) Pos ¶
func (t *TableSampleSize) Pos() token.Pos
func (*TableSampleSize) SQL ¶
func (t *TableSampleSize) SQL() string
type TableSampleUnit ¶
type TableSampleUnit string
const ( PercentTableSampleUnit TableSampleUnit = "PERCENT" RowsTableSampleUnit TableSampleUnit = "ROWS" )
type ThenReturn ¶
type ThenReturn struct { Then token.Pos // position of "THEN" keyword WithAction *WithAction // optional Items []SelectItem }
ThenReturn is THEN RETURN clause in DML.
THEN RETURN {{.WithAction | sqlOpt}} {{.Items | sqlJoin ", "}}
func (*ThenReturn) End ¶
func (t *ThenReturn) End() token.Pos
func (*ThenReturn) Pos ¶
func (t *ThenReturn) Pos() token.Pos
func (*ThenReturn) SQL ¶
func (t *ThenReturn) SQL() string
type TimestampLiteral ¶
type TimestampLiteral struct { Timestamp token.Pos // position of "TIMESTAMP" Value *StringLiteral }
TimestampLiteral is timestamp literal node.
TIMESTAMP {{.Value | sql}}
func (*TimestampLiteral) End ¶
func (t *TimestampLiteral) End() token.Pos
func (*TimestampLiteral) Pos ¶
func (t *TimestampLiteral) Pos() token.Pos
func (*TimestampLiteral) SQL ¶
func (t *TimestampLiteral) SQL() string
type TupleStructLiteral ¶
type TupleStructLiteral struct {
Lparen, Rparen token.Pos // position of "(" and ")"
Values []Expr // len(Values) > 1
}
TupleStructLiteral is tuple syntax struct literal node.
({{.Values | sqlJoin ","}})
func (*TupleStructLiteral) End ¶
func (t *TupleStructLiteral) End() token.Pos
func (*TupleStructLiteral) Pos ¶
func (t *TupleStructLiteral) Pos() token.Pos
func (*TupleStructLiteral) SQL ¶
func (s *TupleStructLiteral) SQL() string
type Type ¶
type Type interface { Node // contains filtered or unexported methods }
Type represents type node.
type TypedStructLiteral ¶
type TypedStructLiteral struct { Struct token.Pos // position of "STRUCT" Rparen token.Pos // position of ")" Fields []*StructField Values []Expr }
TypedStructLiteral is typed struct literal node.
STRUCT<{{.Fields | sqlJoin ","}}>({{.Values | sqlJoin ","}})
func (*TypedStructLiteral) End ¶
func (t *TypedStructLiteral) End() token.Pos
func (*TypedStructLiteral) Pos ¶
func (t *TypedStructLiteral) Pos() token.Pos
func (*TypedStructLiteral) SQL ¶
func (s *TypedStructLiteral) SQL() string
type TypelessStructLiteral ¶
type TypelessStructLiteral struct { Struct token.Pos // position of "STRUCT" Rparen token.Pos // position of ")" Values []TypelessStructLiteralArg }
TypelessStructLiteral is typeless struct literal node.
STRUCT({{.Values | sqlJoin ","}})
func (*TypelessStructLiteral) End ¶
func (t *TypelessStructLiteral) End() token.Pos
func (*TypelessStructLiteral) Pos ¶
func (t *TypelessStructLiteral) Pos() token.Pos
func (*TypelessStructLiteral) SQL ¶
func (s *TypelessStructLiteral) SQL() string
type TypelessStructLiteralArg ¶
type TypelessStructLiteralArg interface { Node // contains filtered or unexported methods }
TypelessStructLiteralArg represents an argument of typeless STRUCT literals.
type Unnest ¶
type Unnest struct { Unnest token.Pos // position of "UNNEST" Rparen token.Pos // position of ")" Expr Expr // Path or Ident when Implicit is true Hint *Hint // optional As *AsAlias // optional WithOffset *WithOffset // optional Sample *TableSample // optional }
Unnest is UNNEST call in FROM clause.
UNNEST({{.Expr | sql}}) {{.Hint | sqlOpt}} {{.As | sqlOpt}} {{.WithOffset | sqlOpt}} {{.Sample | sqlOpt}}
type UnnestInCondition ¶
UnnestInCondition is UNNEST call at IN condition.
UNNEST({{.Expr | sql}})
func (*UnnestInCondition) End ¶
func (u *UnnestInCondition) End() token.Pos
func (*UnnestInCondition) Pos ¶
func (u *UnnestInCondition) Pos() token.Pos
func (*UnnestInCondition) SQL ¶
func (u *UnnestInCondition) SQL() string
type Update ¶
type Update struct { Update token.Pos // position of "UPDATE" keyword Hint *Hint // optional TableName *Path TableHint *Hint // optional As *AsAlias // optional Updates []*UpdateItem // len(Updates) > 0 Where *Where ThenReturn *ThenReturn // optional }
Update is UPDATE statement.
{{.Hint | sqlOpt}} UPDATE {{.TableName | sql}}{{.TableHint | sqlOpt}} {{.As | sqlOpt}} SET {{.Updates | sqlJoin ","}} {{.Where | sql}} {{.ThenReturn | sqlOpt}}
type UpdateItem ¶
type UpdateItem struct { Path []*Ident // len(Path) > 0 DefaultExpr *DefaultExpr }
UpdateItem is SET clause items in UPDATE.
{{.Path | sqlJoin "."}} = {{.DefaultExpr | sql}}
func (*UpdateItem) End ¶
func (u *UpdateItem) End() token.Pos
func (*UpdateItem) Pos ¶
func (u *UpdateItem) Pos() token.Pos
func (*UpdateItem) SQL ¶
func (u *UpdateItem) SQL() string
type UpdatePrivilege ¶
type UpdatePrivilege struct { Update token.Pos // position of "UPDATE" keyword Rparen token.Pos // position of ")" when len(Columns) > 0 Columns []*Ident }
UpdatePrivilege is UPDATE ON TABLE privilege node in GRANT and REVOKE.
UPDATE{{if .Columns}}({{.Columns | sqlJoin ","}}){{end}}
func (*UpdatePrivilege) End ¶
func (u *UpdatePrivilege) End() token.Pos
func (*UpdatePrivilege) Pos ¶
func (u *UpdatePrivilege) Pos() token.Pos
func (*UpdatePrivilege) SQL ¶
func (u *UpdatePrivilege) SQL() string
type Using ¶
type Using struct { Using token.Pos // position of "USING" keyword Rparen token.Pos // position of ")" Idents []*Ident // len(Idents) > 0 }
Using is Using condition of JOIN expression.
USING ({{Idents | sqlJoin ","}})
type ValuesInCondition ¶
type ValuesInCondition struct {
Lparen, Rparen token.Pos // position of "(" and ")"
Exprs []Expr // len(Exprs) > 0
}
ValuesInCondition is parenthesized values at IN condition.
({{.Exprs | sqlJoin ","}})
func (*ValuesInCondition) End ¶
func (v *ValuesInCondition) End() token.Pos
func (*ValuesInCondition) Pos ¶
func (v *ValuesInCondition) Pos() token.Pos
func (*ValuesInCondition) SQL ¶
func (v *ValuesInCondition) SQL() string
type ValuesInput ¶
ValuesInput is VALUES clause in INSERT.
VALUES {{.Rows | sqlJoin ","}}
func (*ValuesInput) End ¶
func (v *ValuesInput) End() token.Pos
func (*ValuesInput) Pos ¶
func (v *ValuesInput) Pos() token.Pos
func (*ValuesInput) SQL ¶
func (v *ValuesInput) SQL() string
type ValuesRow ¶
type ValuesRow struct {
Lparen, Rparen token.Pos // position of "(" and ")"
Exprs []*DefaultExpr
}
ValuesRow is row values of VALUES clause.
({{.Exprs | sqlJoin ","}})
type Visitor ¶ added in v0.3.0
type Visitor interface { Visit(node Node) Visitor VisitMany(nodes []Node) Visitor Field(name string) Visitor Index(index int) Visitor }
Visitor is an interface for visiting AST nodes. If the result of Visit is nil, the node will not be traversed.
type WithAction ¶
type WithAction struct { With token.Pos // position of "WITH" keyword Action token.Pos // position of "ACTION" keyword Alias *AsAlias // optional }
WithAction is WITH ACTION clause in ThenReturn.
WITH ACTION {{.Alias | sqlOpt}}
func (*WithAction) End ¶
func (w *WithAction) End() token.Pos
func (*WithAction) Pos ¶
func (w *WithAction) Pos() token.Pos
func (*WithAction) SQL ¶
func (w *WithAction) SQL() string
type WithExpr ¶
type WithExpr struct { With token.Pos // position of "WITH" keyword Rparen token.Pos // position of ")" Vars []*WithExprVar // len(Vars) > 0 Expr Expr }
WithExpr is WITH expression node.
WITH({{.Vars | sqlJoin ", "}}, {{.Expr | sql}})
type WithExprVar ¶
WithExprVar is "name AS expr" node in WITH expression.
{{.Name | sql}} AS {{.Expr | sql}}
func (*WithExprVar) End ¶
func (w *WithExprVar) End() token.Pos
func (*WithExprVar) Pos ¶
func (w *WithExprVar) Pos() token.Pos
func (*WithExprVar) SQL ¶
func (n *WithExprVar) SQL() string
type WithOffset ¶
type WithOffset struct {
With, Offset token.Pos // position of "WITH" and "OFFSET" keywords
As *AsAlias // optional
}
WithOffset is WITH OFFSET clause node after UNNEST call.
WITH OFFSET {{.As | sqlOpt}}
func (*WithOffset) End ¶
func (w *WithOffset) End() token.Pos
func (*WithOffset) Pos ¶
func (w *WithOffset) Pos() token.Pos
func (*WithOffset) SQL ¶
func (w *WithOffset) SQL() string