ast

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 6 Imported by: 14

Documentation

Overview

Package ast provides AST nodes definitions.

The definitions of ASTs are based on the following document.

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

Constants

This section is empty.

Variables

View Source
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

func Inspect(node Node, f func(Node) bool)

Inspect traverses an AST node in depth-first order and calls f for each node.

func InspectMany added in v0.3.0

func InspectMany[T Node](nodes []T, f func(Node) bool)

InspectMany traverses AST nodes in depth-first order and calls f for each node.

func Preorder added in v0.3.0

func Preorder(node Node) iter.Seq[Node]

Preorder returns an iterator that traverses an AST in depth-first preorder.

func PreorderMany added in v0.3.0

func PreorderMany[T Node](nodes []T) iter.Seq[Node]

PreorderMany returns an iterator that traverses AST nodes in depth-first preorder.

func Walk added in v0.3.0

func Walk(node Node, v Visitor)

Walk traverses an AST node in depth-first order.

func WalkMany added in v0.3.0

func WalkMany[T Node](nodes []T, v Visitor)

Walk traverses AST nodes in depth-first order.

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}}

func (*AddColumn) End

func (a *AddColumn) End() token.Pos

func (*AddColumn) Pos

func (a *AddColumn) Pos() token.Pos

func (*AddColumn) SQL

func (a *AddColumn) SQL() string

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

type AddStoredColumn struct {
	Add token.Pos // position of "ADD" keyword

	Name *Ident
}

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

type AddSynonym struct {
	Add  token.Pos // position of "ADD" pseudo keyword
	Name *Ident
}

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

type Alias struct {
	Expr Expr
	As   *AsAlias
}

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}}

func (*Alias) End

func (a *Alias) End() token.Pos

func (*Alias) Pos

func (a *Alias) Pos() token.Pos

func (*Alias) SQL

func (a *Alias) SQL() string

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 (*AlterColumnAlterIdentity) Pos

func (*AlterColumnAlterIdentity) SQL

type AlterColumnDropDefault

type AlterColumnDropDefault struct {
	Drop    token.Pos
	Default token.Pos
}

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

type AlterColumnSetOptions struct {
	Set     token.Pos
	Options *Options
}

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

type AlterModel struct {
	Alter token.Pos

	IfExists bool
	Name     *Ident
	Options  *Options
}

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 Analyze

type Analyze struct {
	Analyze token.Pos // position of "ANALYZE" keyword
}

Analyze is ANALYZE statement node.

ANALYZE

func (*Analyze) End

func (a *Analyze) End() token.Pos

func (*Analyze) Pos

func (a *Analyze) Pos() token.Pos

func (*Analyze) SQL

func (a *Analyze) 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}}>

func (*ArrayType) End

func (a *ArrayType) End() token.Pos

func (*ArrayType) Pos

func (a *ArrayType) Pos() token.Pos

func (*ArrayType) SQL

func (a *ArrayType) SQL() string

type AsAlias

type AsAlias struct {
	As token.Pos // position of "AS" keyword, optional

	Alias *Ident
}

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}}

func (*AsAlias) End

func (a *AsAlias) End() token.Pos

func (*AsAlias) Pos

func (a *AsAlias) Pos() token.Pos

func (*AsAlias) SQL

func (a *AsAlias) SQL() string

type AsStruct

type AsStruct struct {
	As     token.Pos
	Struct token.Pos
}

AsStruct represents AS STRUCT node in SELECT clause.

AS STRUCT

func (*AsStruct) End

func (a *AsStruct) End() token.Pos

func (*AsStruct) Pos

func (a *AsStruct) Pos() token.Pos

func (*AsStruct) SQL

func (a *AsStruct) SQL() string

type AsTypeName

type AsTypeName struct {
	As       token.Pos
	TypeName *NamedType
}

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 AsValue

type AsValue struct {
	As    token.Pos
	Value token.Pos
}

AsValue represents AS VALUE node in SELECT clause.

AS VALUE

func (*AsValue) End

func (a *AsValue) End() token.Pos

func (*AsValue) Pos

func (a *AsValue) Pos() token.Pos

func (*AsValue) SQL

func (a *AsValue) SQL() string

type AtTimeZone

type AtTimeZone struct {
	At token.Pos // position of "AT" keyword

	Expr Expr
}

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

type AutoIncrement struct {
	AutoIncrement token.Pos // position of "AUTO_INCREMENT"
}

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}}

func (*BadDDL) End

func (b *BadDDL) End() token.Pos

func (*BadDDL) Pos

func (b *BadDDL) Pos() token.Pos

func (*BadDDL) SQL

func (b *BadDDL) SQL() string

type BadDML

type BadDML struct {
	Hint    *Hint // optional
	BadNode *BadNode
}

BadDML is a BadNode for DML.

{{.Hint | sqlOpt}} {{.BadNode | sql}}

func (*BadDML) End

func (b *BadDML) End() token.Pos

func (*BadDML) Pos

func (b *BadDML) Pos() token.Pos

func (*BadDML) SQL

func (b *BadDML) SQL() string

type BadExpr

type BadExpr struct {
	BadNode *BadNode
}

BadExpr is a BadNode for Expr.

{{.BadNode | sql}}

func (*BadExpr) End

func (b *BadExpr) End() token.Pos

func (*BadExpr) Pos

func (b *BadExpr) Pos() token.Pos

func (*BadExpr) SQL

func (b *BadExpr) SQL() string

type BadNode

type BadNode struct {
	NodePos, NodeEnd token.Pos

	Tokens []*token.Token
}

BadNode is a placeholder node for a source code containing syntax errors.

{{.Tokens | tokenJoin}}

func (*BadNode) End

func (b *BadNode) End() token.Pos

func (*BadNode) Pos

func (b *BadNode) Pos() token.Pos

func (*BadNode) SQL

func (b *BadNode) SQL() string

type BadQueryExpr

type BadQueryExpr struct {
	Hint    *Hint
	BadNode *BadNode
}

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

type BadStatement struct {
	Hint    *Hint
	BadNode *BadNode
}

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}}

func (*BadType) End

func (b *BadType) End() token.Pos

func (*BadType) Pos

func (b *BadType) Pos() token.Pos

func (*BadType) SQL

func (b *BadType) SQL() string

type BetweenExpr

type BetweenExpr struct {
	Not                        bool
	Left, RightStart, RightEnd Expr
}

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

type BinaryExpr struct {
	Op BinaryOp

	Left, Right Expr
}

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

type BoolLiteral struct {
	ValuePos token.Pos // position of this value

	Value bool
}

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

type BracedConstructorFieldValueExpr struct {
	Colon token.Pos

	Expr Expr
}

BracedConstructorFieldValueExpr represents a field value node.

: {{.Expr | sql}}

func (*BracedConstructorFieldValueExpr) End

func (*BracedConstructorFieldValueExpr) Pos

func (*BracedConstructorFieldValueExpr) SQL

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

type BytesLiteral struct {
	ValuePos, ValueEnd token.Pos // position of this value

	Value []byte
}

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 CTE

type CTE struct {
	Rparen token.Pos // position of ")"

	Name      *Ident
	QueryExpr QueryExpr
}

CTE is common table expression node.

{{.Name}} AS ({{.QueryExpr}})

func (*CTE) End

func (c *CTE) End() token.Pos

func (*CTE) Pos

func (c *CTE) Pos() token.Pos

func (*CTE) SQL

func (c *CTE) SQL() string

type Call

type Call struct {
	Call   token.Pos
	Rparen token.Pos

	Name *Path
	Args []TVFArg // len(Args) > 0
}

Call is CALL statement.

CALL {{.Name | sql}}({{.Args | sqlJoin ", "}})

func (*Call) End

func (c *Call) End() token.Pos

func (*Call) Pos

func (c *Call) Pos() token.Pos

func (*Call) SQL

func (c *Call) 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}}

func (*CallExpr) End

func (c *CallExpr) End() token.Pos

func (*CallExpr) Pos

func (c *CallExpr) Pos() token.Pos

func (*CallExpr) SQL

func (c *CallExpr) SQL() string

type CaseElse

type CaseElse struct {
	Else token.Pos // position of "ELSE" keyword

	Expr Expr
}

CaseElse is ELSE clause in CASE expression.

ELSE {{.Expr | sql}}

func (*CaseElse) End

func (c *CaseElse) End() token.Pos

func (*CaseElse) Pos

func (c *CaseElse) Pos() token.Pos

func (*CaseElse) SQL

func (c *CaseElse) SQL() string

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

func (*CaseExpr) End

func (c *CaseExpr) End() token.Pos

func (*CaseExpr) Pos

func (c *CaseExpr) Pos() token.Pos

func (*CaseExpr) SQL

func (c *CaseExpr) SQL() string

type CaseWhen

type CaseWhen struct {
	When token.Pos // position of "WHEN" keyword

	Cond, Then Expr
}

CaseWhen is WHEN clause in CASE expression.

WHEN {{.Cond | sql}} THEN {{.Then | sql}}

func (*CaseWhen) End

func (c *CaseWhen) End() token.Pos

func (*CaseWhen) Pos

func (c *CaseWhen) Pos() token.Pos

func (*CaseWhen) SQL

func (c *CaseWhen) SQL() string

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}})

func (*CastExpr) End

func (c *CastExpr) End() token.Pos

func (*CastExpr) Pos

func (c *CastExpr) Pos() token.Pos

func (*CastExpr) SQL

func (c *CastExpr) SQL() string

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

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

type ChangeStreamSetOptions struct {
	Set token.Pos // position of "SET" keyword

	Options *Options
}

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

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}})

func (*Check) End

func (c *Check) End() token.Pos

func (*Check) Pos

func (c *Check) Pos() token.Pos

func (*Check) SQL

func (c *Check) SQL() string

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}}

func (*Cluster) End

func (c *Cluster) End() token.Pos

func (*Cluster) Pos

func (c *Cluster) Pos() token.Pos

func (*Cluster) SQL

func (c *Cluster) SQL() string

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}}

func (*Collate) End

func (c *Collate) End() token.Pos

func (*Collate) Pos

func (c *Collate) Pos() token.Pos

func (*Collate) SQL

func (c *Collate) SQL() string

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}}

func (*ColumnDef) End

func (c *ColumnDef) End() token.Pos

func (*ColumnDef) Pos

func (c *ColumnDef) Pos() token.Pos

func (*ColumnDef) SQL

func (c *ColumnDef) SQL() string

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

type CreateDatabase struct {
	Create token.Pos // position of "CREATE" keyword

	Name *Ident
}

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

type CreateRole struct {
	Create token.Pos // position of "CREATE" keyword

	Name *Ident
}

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 (*CreateRowDeletionPolicy) Pos

func (*CreateRowDeletionPolicy) SQL

type CreateSchema

type CreateSchema struct {
	Create token.Pos // position of "CREATE" keyword

	Name *Ident
}

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

type DefaultExpr struct {
	DefaultPos token.Pos // position of "DEFAULT"

	Default bool
	Expr    Expr
}

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}}

func (*Delete) End

func (d *Delete) End() token.Pos

func (*Delete) Pos

func (d *Delete) Pos() token.Pos

func (*Delete) SQL

func (d *Delete) SQL() string

type DeletePrivilege

type DeletePrivilege struct {
	Delete token.Pos // position of "DELETE" keyword
}

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 Direction

type Direction string
const (
	DirectionAsc  Direction = "ASC"
	DirectionDesc Direction = "DESC"
)

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}}

func (*DotStar) End

func (d *DotStar) End() token.Pos

func (*DotStar) Pos

func (d *DotStar) Pos() token.Pos

func (*DotStar) SQL

func (s *DotStar) SQL() string

type DropChangeStream

type DropChangeStream struct {
	Drop token.Pos // position of "DROP" keyword

	Name *Ident
}

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

type DropColumn struct {
	Drop token.Pos // position of  "DROP" keyword

	Name *Ident
}

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

type DropConstraint struct {
	Drop token.Pos // position of  "DROP" keyword

	Name *Ident
}

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

type DropIndex struct {
	Drop token.Pos // position of "DROP" keyword

	IfExists bool
	Name     *Path
}

DropIndex is DROP INDEX statement node.

DROP INDEX {{if .IfExists}}IF EXISTS{{end}} {{.Name | sql}}

func (*DropIndex) End

func (d *DropIndex) End() token.Pos

func (*DropIndex) Pos

func (d *DropIndex) Pos() token.Pos

func (*DropIndex) SQL

func (d *DropIndex) SQL() string

type DropModel

type DropModel struct {
	Drop token.Pos

	IfExists bool
	Name     *Ident
}

DropModel is DROP MODEL statement node.

DROP MODEL {{if .IfExists}}IF EXISTS{{end}} {{.Name | sql}}

func (*DropModel) End

func (d *DropModel) End() token.Pos

func (*DropModel) Pos

func (d *DropModel) Pos() token.Pos

func (*DropModel) SQL

func (d *DropModel) SQL() string

type DropPropertyGraph added in v0.3.0

type DropPropertyGraph struct {
	Drop token.Pos

	IfExists bool
	Name     *Ident
}

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 DropRole

type DropRole struct {
	Drop token.Pos // position of "DROP" keyword

	Name *Ident
}

DropRole is DROP ROLE statement node.

DROP ROLE {{.Name | sql}}

func (*DropRole) End

func (d *DropRole) End() token.Pos

func (*DropRole) Pos

func (d *DropRole) Pos() token.Pos

func (*DropRole) SQL

func (d *DropRole) 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

type DropSchema struct {
	Drop token.Pos // position of "DROP" keyword

	Name *Ident
}

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

type DropSearchIndex struct {
	Drop     token.Pos
	IfExists bool
	Name     *Ident
}

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

type DropSequence struct {
	Drop     token.Pos
	IfExists bool
	Name     *Path
}

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

type DropStoredColumn struct {
	Drop token.Pos // position of "DROP" keyword

	Name *Ident
}

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

type DropSynonym struct {
	Drop token.Pos // position of "DROP" pseudo keyword
	Name *Ident
}

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

type DropTable struct {
	Drop token.Pos // position of "DROP" keyword

	IfExists bool
	Name     *Path
}

DropTable is DROP TABLE statement node.

DROP TABLE {{if .IfExists}}IF NOT EXISTS{{end}} {{.Name | sql}}

func (*DropTable) End

func (d *DropTable) End() token.Pos

func (*DropTable) Pos

func (d *DropTable) Pos() token.Pos

func (*DropTable) SQL

func (d *DropTable) SQL() string

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 DropView

type DropView struct {
	Drop token.Pos

	Name *Path
}

DropView is DROP VIEW statement node.

DROP VIEW {{.Name | sql}}

func (*DropView) End

func (d *DropView) End() token.Pos

func (*DropView) Pos

func (d *DropView) Pos() token.Pos

func (*DropView) SQL

func (d *DropView) SQL() string

type ExecutePrivilegeOnTableFunction

type ExecutePrivilegeOnTableFunction struct {
	Execute token.Pos

	Names []*Ident // len(Names) > 0
}

ExecutePrivilegeOnTableFunction is EXECUTE ON TABLE FUNCTION privilege node in GRANT and REVOKE.

EXECUTE ON TABLE FUNCTION {{.Names | sqlJoin ","}}

func (*ExecutePrivilegeOnTableFunction) End

func (*ExecutePrivilegeOnTableFunction) Pos

func (*ExecutePrivilegeOnTableFunction) SQL

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}}

func (*ExprArg) End

func (e *ExprArg) End() token.Pos

func (*ExprArg) Pos

func (e *ExprArg) Pos() token.Pos

func (*ExprArg) SQL

func (s *ExprArg) SQL() string

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

type FloatLiteral struct {
	ValuePos, ValueEnd token.Pos // position of this value

	Value string
}

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 ForUpdate added in v0.4.0

type ForUpdate struct {
	For, Update token.Pos
}

ForUpdate is FOR UPDATE node.

FOR UPDATE

func (*ForUpdate) End added in v0.4.0

func (f *ForUpdate) End() token.Pos

func (*ForUpdate) Pos added in v0.4.0

func (f *ForUpdate) Pos() token.Pos

func (*ForUpdate) SQL added in v0.4.0

func (f *ForUpdate) 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 From

type From struct {
	From token.Pos // position of "FROM" keyword

	Source TableExpr
}

From is FROM clause node.

FROM {{.Source | sql}}

func (*From) End

func (f *From) End() token.Pos

func (*From) Pos

func (f *From) Pos() token.Pos

func (*From) SQL

func (f *From) SQL() string

type FromQuery

type FromQuery struct {
	From *From
}

FromQuery is FROM query expression node.

FROM {{.From | sql}}

func (*FromQuery) End

func (f *FromQuery) End() token.Pos

func (*FromQuery) Pos

func (f *FromQuery) Pos() token.Pos

func (*FromQuery) SQL

func (f *FromQuery) SQL() string

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 ","}}

func (*Grant) End

func (g *Grant) End() token.Pos

func (*Grant) Pos

func (g *Grant) Pos() token.Pos

func (*Grant) SQL

func (g *Grant) SQL() string

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 ","}}

func (*GroupBy) End

func (g *GroupBy) End() token.Pos

func (*GroupBy) Pos

func (g *GroupBy) Pos() token.Pos

func (*GroupBy) SQL

func (g *GroupBy) SQL() string

type Having

type Having struct {
	Having token.Pos // position of "HAVING" keyword

	Expr Expr
}

Having is HAVING clause node.

HAVING {{.Expr | sql}}

func (*Having) End

func (h *Having) End() token.Pos

func (*Having) Pos

func (h *Having) Pos() token.Pos

func (*Having) SQL

func (h *Having) SQL() string

type HavingMax

type HavingMax struct {
	Having token.Pos
	Expr   Expr
}

HavingMax represents HAVING MAX of aggregate function calls.

HAVING MAX {{Expr | sql}}

func (*HavingMax) End

func (h *HavingMax) End() token.Pos

func (*HavingMax) Pos

func (h *HavingMax) Pos() token.Pos

func (*HavingMax) SQL

func (h *HavingMax) SQL() string

type HavingMin

type HavingMin struct {
	Having token.Pos
	Expr   Expr
}

HavingMin represents HAVING MIN of aggregate function calls.

HAVING MIN {{Expr | sql}}

func (*HavingMin) End

func (h *HavingMin) End() token.Pos

func (*HavingMin) Pos

func (h *HavingMin) Pos() token.Pos

func (*HavingMin) SQL

func (h *HavingMin) SQL() string

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 ","}}{{"}"}}

func (*Hint) End

func (h *Hint) End() token.Pos

func (*Hint) Pos

func (h *Hint) Pos() token.Pos

func (*Hint) SQL

func (h *Hint) SQL() string

type HintRecord

type HintRecord struct {
	Key   *Path
	Value Expr
}

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 Ident

type Ident struct {
	NamePos, NameEnd token.Pos // position of this name

	Name string
}

Ident is identifier node.

{{.Name | sqlIdentQuote}}

func (*Ident) End

func (i *Ident) End() token.Pos

func (*Ident) Pos

func (i *Ident) Pos() token.Pos

func (*Ident) SQL

func (i *Ident) 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}})

func (*IfExpr) End

func (i *IfExpr) End() token.Pos

func (*IfExpr) Pos

func (i *IfExpr) Pos() token.Pos

func (*IfExpr) SQL

func (i *IfExpr) SQL() string

type IgnoreNulls

type IgnoreNulls struct {
	Ignore token.Pos
	Nulls  token.Pos
}

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}}

func (*InExpr) End

func (i *InExpr) End() token.Pos

func (*InExpr) Pos

func (i *InExpr) Pos() token.Pos

func (*InExpr) SQL

func (i *InExpr) SQL() string

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}}]

func (*IndexExpr) End

func (i *IndexExpr) End() token.Pos

func (*IndexExpr) Pos

func (i *IndexExpr) Pos() token.Pos

func (*IndexExpr) SQL

func (i *IndexExpr) SQL() string

type IndexKey

type IndexKey struct {
	DirPos token.Pos // position of Dir

	Name *Ident
	Dir  Direction // optional
}

IndexKey is index key specifier in CREATE TABLE and CREATE INDEX.

{{.Name | sql}} {{.Dir}}

func (*IndexKey) End

func (i *IndexKey) End() token.Pos

func (*IndexKey) Pos

func (i *IndexKey) Pos() token.Pos

func (*IndexKey) SQL

func (i *IndexKey) SQL() string

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}}

func (*Insert) End

func (i *Insert) End() token.Pos

func (*Insert) Pos

func (i *Insert) Pos() token.Pos

func (*Insert) SQL

func (i *Insert) SQL() string

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

type InterleaveIn struct {
	Comma token.Pos // position of ","

	TableName *Ident
}

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

type IsBoolExpr struct {
	RightPos token.Pos // position of Right

	Not   bool
	Left  Expr
	Right bool
}

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

type IsNullExpr struct {
	Null token.Pos // position of "NULL"

	Not  bool
	Left Expr
}

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}}

func (*Join) End

func (j *Join) End() token.Pos

func (*Join) Pos

func (j *Join) Pos() token.Pos

func (*Join) SQL

func (j *Join) SQL() string

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 JoinOp

type JoinOp string
const (
	CommaJoin      JoinOp = ","
	CrossJoin      JoinOp = "CROSS JOIN"
	InnerJoin      JoinOp = "INNER JOIN"
	FullOuterJoin  JoinOp = "FULL OUTER JOIN"
	LeftOuterJoin  JoinOp = "LEFT OUTER JOIN"
	RightOuterJoin JoinOp = "RIGHT OUTER JOIN"
)

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.

func (*LambdaArg) End

func (l *LambdaArg) End() token.Pos

func (*LambdaArg) Pos

func (l *LambdaArg) Pos() token.Pos

func (*LambdaArg) SQL

func (l *LambdaArg) SQL() string

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}}

func (*Limit) End

func (l *Limit) End() token.Pos

func (*Limit) Pos

func (l *Limit) Pos() token.Pos

func (*Limit) SQL

func (l *Limit) SQL() string

type ModelArg

type ModelArg struct {
	Model token.Pos // position of "MODEL" keyword

	Name *Path
}

ModelArg is argument of model function call.

MODEL {{.Name | sql}}

func (*ModelArg) End

func (m *ModelArg) End() token.Pos

func (*ModelArg) Pos

func (m *ModelArg) Pos() token.Pos

func (*ModelArg) SQL

func (s *ModelArg) SQL() string

type NamedArg

type NamedArg struct {
	Name  *Ident
	Value Expr
}

NamedArg represents a name and value pair in named arguments

{{.Name | sql}} => {{.Value | sql}}

func (*NamedArg) End

func (n *NamedArg) End() token.Pos

func (*NamedArg) Pos

func (n *NamedArg) Pos() token.Pos

func (*NamedArg) SQL

func (n *NamedArg) SQL() string

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 "."}}

func (*NamedType) End

func (n *NamedType) End() token.Pos

func (*NamedType) Pos

func (n *NamedType) Pos() token.Pos

func (*NamedType) SQL

func (n *NamedType) SQL() string

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

type NoSkipRange struct {
	No, Range token.Pos
}

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

type NullLiteral struct {
	Null token.Pos // position of "NULL"
}

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 Offset

type Offset struct {
	Offset token.Pos // position of "OFFSET" keyword

	Value IntValue
}

Offset is OFFSET clause node in LIMIT clause.

OFFSET {{.Value | sql}}

func (*Offset) End

func (o *Offset) End() token.Pos

func (*Offset) Pos

func (o *Offset) Pos() token.Pos

func (*Offset) SQL

func (o *Offset) SQL() string

type On

type On struct {
	On token.Pos // position of "ON" keyword

	Expr Expr
}

On is ON condition of JOIN expression.

ON {{.Expr | sql}}

func (*On) End

func (o *On) End() token.Pos

func (*On) Pos

func (o *On) Pos() token.Pos

func (*On) SQL

func (o *On) 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

func (o *Options) BoolField(name string) (*bool, error)

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) End

func (o *Options) End() token.Pos

func (*Options) Field

func (o *Options) Field(name string) (expr Expr, found bool)

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

func (o *Options) IntegerField(name string) (*int64, error)

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) Pos

func (o *Options) Pos() token.Pos

func (*Options) SQL

func (g *Options) SQL() string

func (*Options) StringField

func (o *Options) StringField(name string) (*string, error)

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

type OptionsDef struct {
	Name  *Ident
	Value Expr
}

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 ","}}

func (*OrderBy) End

func (o *OrderBy) End() token.Pos

func (*OrderBy) Pos

func (o *OrderBy) Pos() token.Pos

func (*OrderBy) SQL

func (o *OrderBy) SQL() string

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 Param

type Param struct {
	Atmark token.Pos

	Name string
}

Param is Query parameter node.

@{{.Name}}

func (*Param) End

func (p *Param) End() token.Pos

func (*Param) Pos

func (p *Param) Pos() token.Pos

func (*Param) SQL

func (p *Param) SQL() string

type ParenExpr

type ParenExpr struct {
	Lparen, Rparen token.Pos // position of "(" and ")"

	Expr Expr
}

ParenExpr is parenthesized expression node.

({{. | sql}})

func (*ParenExpr) End

func (p *ParenExpr) End() token.Pos

func (*ParenExpr) Pos

func (p *ParenExpr) Pos() token.Pos

func (*ParenExpr) SQL

func (p *ParenExpr) 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 "."}}

func (*Path) End

func (p *Path) End() token.Pos

func (*Path) Pos

func (p *Path) Pos() token.Pos

func (*Path) SQL

func (p *Path) SQL() string

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 PipeWhere

type PipeWhere struct {
	Pipe token.Pos // position of "|>"

	Expr Expr
}

PipeWhere is WHERE pipe operator node.

|> WHERE {{.Expr | sql}}

func (*PipeWhere) End

func (p *PipeWhere) End() token.Pos

func (*PipeWhere) Pos

func (p *PipeWhere) Pos() token.Pos

func (*PipeWhere) SQL

func (p *PipeWhere) 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

type PropertyGraphColumnNameList struct {
	Lparen, Rparen token.Pos

	ColumnNameList []*Ident
}

PropertyGraphColumnNameList represents one or more columns to assign to a key.

({{.ColumnNameList | sqlJoin ", "}})

func (*PropertyGraphColumnNameList) End added in v0.3.0

func (*PropertyGraphColumnNameList) Pos added in v0.3.0

func (*PropertyGraphColumnNameList) SQL added in v0.3.0

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

type PropertyGraphDerivedProperty struct {
	Expr  Expr
	Alias *Ident // optional
}

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 (*PropertyGraphDerivedProperty) Pos added in v0.3.0

func (*PropertyGraphDerivedProperty) SQL added in v0.3.0

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 (*PropertyGraphDerivedPropertyList) Pos added in v0.3.0

func (*PropertyGraphDerivedPropertyList) SQL added in v0.3.0

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 (*PropertyGraphDestinationKey) Pos added in v0.3.0

func (*PropertyGraphDestinationKey) SQL added in v0.3.0

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 (*PropertyGraphEdgeElementKeys) Pos added in v0.3.0

func (*PropertyGraphEdgeElementKeys) SQL added in v0.3.0

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 (*PropertyGraphEdgeTables) Pos added in v0.3.0

func (*PropertyGraphEdgeTables) SQL added in v0.3.0

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 (*PropertyGraphElementKey) Pos added in v0.3.0

func (*PropertyGraphElementKey) SQL added in v0.3.0

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

type PropertyGraphElementLabelDefaultLabel struct {
	Default token.Pos
	Label   token.Pos
}

PropertyGraphElementLabelDefaultLabel represents DEFAULT LABEL node.

DEFAULT LABEL

func (*PropertyGraphElementLabelDefaultLabel) End added in v0.3.0

func (*PropertyGraphElementLabelDefaultLabel) Pos added in v0.3.0

func (*PropertyGraphElementLabelDefaultLabel) SQL added in v0.3.0

type PropertyGraphElementLabelLabelName added in v0.3.0

type PropertyGraphElementLabelLabelName struct {
	Label token.Pos
	Name  *Ident
}

PropertyGraphElementLabelLabelName represents LABEL label_name node.

LABEL {{.Name | sql}}

func (*PropertyGraphElementLabelLabelName) End added in v0.3.0

func (*PropertyGraphElementLabelLabelName) Pos added in v0.3.0

func (*PropertyGraphElementLabelLabelName) SQL added in v0.3.0

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 (*PropertyGraphElementList) Pos added in v0.3.0

func (*PropertyGraphElementList) SQL added in v0.3.0

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 (*PropertyGraphLabelAndProperties) Pos added in v0.3.0

func (*PropertyGraphLabelAndProperties) SQL added in v0.3.0

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 (*PropertyGraphLabelAndPropertiesList) Pos added in v0.3.0

func (*PropertyGraphLabelAndPropertiesList) SQL added in v0.3.0

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 (*PropertyGraphNoProperties) Pos added in v0.3.0

func (*PropertyGraphNoProperties) SQL added in v0.3.0

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 (*PropertyGraphNodeElementKey) Pos added in v0.3.0

func (*PropertyGraphNodeElementKey) SQL added in v0.3.0

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 (*PropertyGraphNodeTables) Pos added in v0.3.0

func (*PropertyGraphNodeTables) SQL added in v0.3.0

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 (*PropertyGraphPropertiesAre) Pos added in v0.3.0

func (*PropertyGraphPropertiesAre) SQL added in v0.3.0

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 (*PropertyGraphSingleProperties) Pos added in v0.3.0

func (*PropertyGraphSingleProperties) SQL added in v0.3.0

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

type ProtoBundleTypes struct {
	Lparen, Rparen token.Pos
	Types          []*NamedType
}

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 ", "}}

https://cloud.google.com/spanner/docs/query-syntax

func (*Query) End

func (q *Query) End() token.Pos

func (*Query) Pos

func (q *Query) Pos() token.Pos

func (*Query) SQL

func (q *Query) SQL() string

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

type QueryStatement struct {
	Hint  *Hint // optional
	Query QueryExpr
}

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

type RenameTableTo struct {
	Old *Ident
	New *Ident
}

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}}

func (*RenameTo) End

func (r *RenameTo) End() token.Pos

func (*RenameTo) Pos

func (r *RenameTo) Pos() token.Pos

func (*RenameTo) SQL

func (t *RenameTo) SQL() string

type ReplaceFieldsArg

type ReplaceFieldsArg struct {
	Expr  Expr
	Field *Path
}

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 (*ReplaceRowDeletionPolicy) Pos

func (*ReplaceRowDeletionPolicy) SQL

type RespectNulls

type RespectNulls struct {
	Respect token.Pos
	Nulls   token.Pos
}

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 ","}}

func (*Revoke) End

func (r *Revoke) End() token.Pos

func (*Revoke) Pos

func (r *Revoke) Pos() token.Pos

func (*Revoke) SQL

func (r *Revoke) SQL() string

type RolePrivilege

type RolePrivilege struct {
	Role token.Pos

	Names []*Ident // len(Names) > 0
}

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

type ScalarSubQuery struct {
	Lparen, Rparen token.Pos // position of "(" and ")"

	Query QueryExpr
}

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}}

func (*Select) End

func (s *Select) End() token.Pos

func (*Select) Pos

func (s *Select) Pos() token.Pos

func (*Select) SQL

func (s *Select) SQL() string

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

type SelectPrivilegeOnChangeStream struct {
	Select token.Pos

	Names []*Ident // len(Names) > 0
}

SelectPrivilegeOnChangeStream is SELECT ON CHANGE STREAM privilege node in GRANT and REVOKE.

SELECT ON CHANGE STREAM {{.Names | sqlJoin ", "}}

func (*SelectPrivilegeOnChangeStream) End

func (*SelectPrivilegeOnChangeStream) Pos

func (*SelectPrivilegeOnChangeStream) SQL

type SelectPrivilegeOnView

type SelectPrivilegeOnView struct {
	Select token.Pos

	Names []*Ident // len(Names) > 0
}

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

type SelectorExpr struct {
	Expr  Expr
	Ident *Ident
}

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

type SequenceArg struct {
	Sequence token.Pos // position of "SEQUENCE" keyword

	Expr Expr
}

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 SetOp

type SetOp string
const (
	SetOpUnion     SetOp = "UNION"
	SetOpIntersect SetOp = "INTERSECT"
	SetOpExcept    SetOp = "EXCEPT"
)

type SetSkipRange

type SetSkipRange struct {
	Set       token.Pos
	SkipRange *SkipRange
}

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}}

func (*SkipRange) End

func (s *SkipRange) End() token.Pos

func (*SkipRange) Pos

func (s *SkipRange) Pos() token.Pos

func (*SkipRange) SQL

func (s *SkipRange) SQL() string

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.

func (*Star) End

func (s *Star) End() token.Pos

func (*Star) Pos

func (s *Star) Pos() token.Pos

func (*Star) SQL

func (s *Star) SQL() string

type StarModifierExcept

type StarModifierExcept struct {
	Except token.Pos
	Rparen token.Pos

	Columns []*Ident
}

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

type StarModifierReplaceItem struct {
	Expr Expr
	Name *Ident
}

StarModifierReplaceItem is a single item of StarModifierReplace.

{{.Expr | sql}} AS {{.Name | sql}}

func (*StarModifierReplaceItem) End

func (*StarModifierReplaceItem) Pos

func (*StarModifierReplaceItem) SQL

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 ","}})

func (*Storing) End

func (s *Storing) End() token.Pos

func (*Storing) Pos

func (s *Storing) Pos() token.Pos

func (*Storing) SQL

func (s *Storing) SQL() string

type StringLiteral

type StringLiteral struct {
	ValuePos, ValueEnd token.Pos // position of this value

	Value string
}

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

type StructField struct {
	Ident *Ident
	Type  Type
}

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

type SubQuery struct {
	Lparen, Rparen token.Pos // position of "(" and ")"

	Query QueryExpr
}

SubQuery is parenthesized query expression node. Note: subquery expression is expressed as a ParenTableExpr. Maybe better to rename as like ParenQueryExpr?

({{.Query | sql}})

func (*SubQuery) End

func (s *SubQuery) End() token.Pos

func (*SubQuery) Pos

func (s *SubQuery) Pos() token.Pos

func (*SubQuery) SQL

func (s *SubQuery) SQL() string

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 (*SubscriptSpecifierKeyword) Pos

func (*SubscriptSpecifierKeyword) SQL

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})

func (*Synonym) End

func (s *Synonym) End() token.Pos

func (*Synonym) Pos

func (s *Synonym) Pos() token.Pos

func (*Synonym) SQL

func (s *Synonym) SQL() string

type TVFArg

type TVFArg interface {
	Node
	// contains filtered or unexported methods
}

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

type TableArg struct {
	Table token.Pos // position of "TABLE" keyword

	Name *Path
}

TableArg is TABLE table_name argument of table valued function call.

TABLE {{.Name | sql}}

func (*TableArg) End

func (t *TableArg) End() token.Pos

func (*TableArg) Pos

func (t *TableArg) Pos() token.Pos

func (*TableArg) SQL

func (s *TableArg) SQL() string

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}}

func (*TableName) End

func (t *TableName) End() token.Pos

func (*TableName) Pos

func (t *TableName) Pos() token.Pos

func (*TableName) SQL

func (t *TableName) SQL() string

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 UnaryExpr

type UnaryExpr struct {
	OpPos token.Pos // position of Op

	Op   UnaryOp
	Expr Expr
}

UnaryExpr is unary operator expression node.

{{.Op}} {{.Expr | sql}}

func (*UnaryExpr) End

func (u *UnaryExpr) End() token.Pos

func (*UnaryExpr) Pos

func (u *UnaryExpr) Pos() token.Pos

func (*UnaryExpr) SQL

func (u *UnaryExpr) SQL() string

type UnaryOp

type UnaryOp string
const (
	OpNot    UnaryOp = "NOT"
	OpPlus   UnaryOp = "+"
	OpMinus  UnaryOp = "-"
	OpBitNot UnaryOp = "~"
)

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}}

func (*Unnest) End

func (u *Unnest) End() token.Pos

func (*Unnest) Pos

func (u *Unnest) Pos() token.Pos

func (*Unnest) SQL

func (u *Unnest) SQL() string

type UnnestInCondition

type UnnestInCondition struct {
	Unnest token.Pos
	Rparen token.Pos

	Expr Expr
}

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}}

func (*Update) End

func (u *Update) End() token.Pos

func (*Update) Pos

func (u *Update) Pos() token.Pos

func (*Update) SQL

func (u *Update) SQL() string

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 ","}})

func (*Using) End

func (u *Using) End() token.Pos

func (*Using) Pos

func (u *Using) Pos() token.Pos

func (*Using) SQL

func (u *Using) SQL() string

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

type ValuesInput struct {
	Values token.Pos // position of "VALUES" keyword

	Rows []*ValuesRow
}

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 ","}})

func (*ValuesRow) End

func (v *ValuesRow) End() token.Pos

func (*ValuesRow) Pos

func (v *ValuesRow) Pos() token.Pos

func (*ValuesRow) SQL

func (v *ValuesRow) SQL() string

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 Where

type Where struct {
	Where token.Pos // position of "WHERE" keyword

	Expr Expr
}

Where is WHERE clause node.

WHERE {{.Expr | sql}}

func (*Where) End

func (w *Where) End() token.Pos

func (*Where) Pos

func (w *Where) Pos() token.Pos

func (*Where) SQL

func (w *Where) SQL() string

type With

type With struct {
	With token.Pos // position of "WITH" keyword

	CTEs []*CTE
}

With is with clause node.

WITH {{.CTEs | sqlJoin ","}}

func (*With) End

func (w *With) End() token.Pos

func (*With) Pos

func (w *With) Pos() token.Pos

func (*With) SQL

func (w *With) SQL() string

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}})

func (*WithExpr) End

func (w *WithExpr) End() token.Pos

func (*WithExpr) Pos

func (w *WithExpr) Pos() token.Pos

func (*WithExpr) SQL

func (w *WithExpr) SQL() string

type WithExprVar

type WithExprVar struct {
	Name *Ident
	Expr Expr
}

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

Jump to

Keyboard shortcuts

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