Documentation ¶
Overview ¶
Package spansql contains types and a parser for the Cloud Spanner SQL dialect.
To parse, use one of the Parse functions (ParseDDL, ParseDDLStmt, ParseQuery, etc.).
Sources:
https://cloud.google.com/spanner/docs/lexical https://cloud.google.com/spanner/docs/query-syntax https://cloud.google.com/spanner/docs/data-definition-language
Index ¶
- Constants
- func IsKeyword(id string) bool
- type AddColumn
- type AddConstraint
- type AddRowDeletionPolicy
- type AddStoredColumn
- type AddSynonym
- type AggregateHaving
- type AggregateHavingCondition
- type AlterChangeStream
- type AlterChangeStreamOptions
- type AlterColumn
- type AlterDatabase
- type AlterIndex
- type AlterSequence
- type AlterStatistics
- type AlterTable
- type AlterWatch
- type ArithOp
- type ArithOperator
- type Array
- type AtTimeZoneExpr
- type BoolExpr
- type BoolLiteral
- type BytesLiteral
- type Case
- type ChangeStreamAlteration
- type ChangeStreamOptions
- type Check
- type Coalesce
- type ColumnAlteration
- type ColumnDef
- type ColumnOptions
- type Comment
- type ComparisonOp
- type ComparisonOperator
- type Constraint
- type CreateChangeStream
- type CreateIndex
- type CreateRole
- type CreateSequence
- type CreateTable
- type CreateView
- type DDL
- type DDLStmt
- type DML
- type DMLStmt
- type DatabaseAlteration
- type DatabaseOptions
- type DateLiteral
- type Delete
- type DropChangeStream
- type DropChangeStreamWatch
- type DropColumn
- type DropConstraint
- type DropDefault
- type DropIndex
- type DropRole
- type DropRowDeletionPolicy
- type DropSequence
- type DropStoredColumn
- type DropSynonym
- type DropTable
- type DropView
- type Expr
- type ExtractExpr
- type FloatLiteral
- type ForeignKey
- type Func
- type GrantRole
- type ID
- type If
- type IfNull
- type InOp
- type IndexAlteration
- type Insert
- type IntegerLiteral
- type Interleave
- type IntervalExpr
- type IsExpr
- type IsOp
- type JSONLiteral
- type JoinType
- type KeyPart
- type LiteralOrParam
- type LogicalOp
- type LogicalOperator
- type Node
- type NullIf
- type NullLiteral
- type NullsHandling
- type OnDelete
- type Order
- type Param
- type Paren
- type PathExp
- type Position
- type Privilege
- type PrivilegeType
- type Query
- type RenameTable
- type RenameTo
- type ReplaceRowDeletionPolicy
- type RevokeRole
- type RowDeletionPolicy
- type SecurityType
- type Select
- type SelectFrom
- type SelectFromJoin
- type SelectFromTable
- type SelectFromUnnest
- type SequenceAlteration
- type SequenceExpr
- type SequenceOptions
- type SetColumnOptions
- type SetColumnType
- type SetDatabaseOptions
- type SetDefault
- type SetOnDelete
- type SetSequenceOptions
- type SetStatisticsOptions
- type StarExpr
- type StatisticsAlteration
- type StatisticsOptions
- type StringLiteral
- type TableAlteration
- type TableConstraint
- type TableRenameOp
- type TableSample
- type TableSampleMethod
- type TableSampleSizeType
- type TimestampLiteral
- type Type
- type TypeBase
- type TypedExpr
- type Update
- type UpdateItem
- type Values
- type ValuesOrSelect
- type WatchDef
- type WhenClause
Constants ¶
const ( True = BoolLiteral(true) False = BoolLiteral(false) )
const MaxLen = math.MaxInt64
MaxLen is a sentinel for Type's Len field, representing the MAX value.
const Null = NullLiteral(0)
const Star = StarExpr(0)
Star represents a "*" in an expression.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddConstraint ¶
type AddConstraint struct{ Constraint TableConstraint }
func (AddConstraint) SQL ¶
func (ac AddConstraint) SQL() string
type AddRowDeletionPolicy ¶
type AddRowDeletionPolicy struct{ RowDeletionPolicy RowDeletionPolicy }
func (AddRowDeletionPolicy) SQL ¶
func (ardp AddRowDeletionPolicy) SQL() string
type AddStoredColumn ¶
type AddStoredColumn struct{ Name ID }
func (AddStoredColumn) SQL ¶
func (asc AddStoredColumn) SQL() string
type AddSynonym ¶
type AddSynonym struct{ Name ID }
func (AddSynonym) SQL ¶
func (as AddSynonym) SQL() string
type AggregateHaving ¶
type AggregateHaving struct { Condition AggregateHavingCondition Expr Expr }
AggregateHaving represents the HAVING clause specific to aggregate functions, restricting rows based on a maximal or minimal value.
type AggregateHavingCondition ¶
type AggregateHavingCondition int
AggregateHavingCondition represents the condition (MAX or MIN) for the AggregateHaving clause.
const ( HavingMax AggregateHavingCondition = iota HavingMin )
type AlterChangeStream ¶
type AlterChangeStream struct { Name ID Alteration ChangeStreamAlteration Position Position }
AlterChangeStream represents a ALTER CHANGE STREAM statement.
func (*AlterChangeStream) Pos ¶
func (acs *AlterChangeStream) Pos() Position
func (AlterChangeStream) SQL ¶
func (acs AlterChangeStream) SQL() string
func (*AlterChangeStream) String ¶
func (acs *AlterChangeStream) String() string
type AlterChangeStreamOptions ¶
type AlterChangeStreamOptions struct{ Options ChangeStreamOptions }
func (AlterChangeStreamOptions) SQL ¶
func (ao AlterChangeStreamOptions) SQL() string
type AlterColumn ¶
type AlterColumn struct { Name ID Alteration ColumnAlteration }
func (AlterColumn) SQL ¶
func (ac AlterColumn) SQL() string
type AlterDatabase ¶
type AlterDatabase struct { Name ID Alteration DatabaseAlteration Position Position // position of the "ALTER" token }
AlterDatabase represents an ALTER DATABASE statement. https://cloud.google.com/spanner/docs/data-definition-language#alter-database
func (*AlterDatabase) Pos ¶
func (ad *AlterDatabase) Pos() Position
func (AlterDatabase) SQL ¶
func (ad AlterDatabase) SQL() string
func (*AlterDatabase) String ¶
func (ad *AlterDatabase) String() string
type AlterIndex ¶
type AlterIndex struct { Name ID Alteration IndexAlteration Position Position // position of the "ALTER" token }
func (*AlterIndex) Pos ¶
func (as *AlterIndex) Pos() Position
func (AlterIndex) SQL ¶
func (ai AlterIndex) SQL() string
func (*AlterIndex) String ¶
func (as *AlterIndex) String() string
type AlterSequence ¶
type AlterSequence struct { Name ID Alteration SequenceAlteration Position Position }
AlterSequence represents an ALTER SEQUENCE statement. https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#alter-sequence
func (*AlterSequence) Pos ¶
func (as *AlterSequence) Pos() Position
func (AlterSequence) SQL ¶
func (as AlterSequence) SQL() string
func (*AlterSequence) String ¶
func (as *AlterSequence) String() string
type AlterStatistics ¶
type AlterStatistics struct { Name ID Alteration StatisticsAlteration Position Position // position of the "ALTER" token }
AlterStatistics represents an ALTER STATISTICS statement. https://cloud.google.com/spanner/docs/data-definition-language#alter-statistics
func (*AlterStatistics) Pos ¶
func (as *AlterStatistics) Pos() Position
func (AlterStatistics) SQL ¶
func (as AlterStatistics) SQL() string
func (*AlterStatistics) String ¶
func (as *AlterStatistics) String() string
type AlterTable ¶
type AlterTable struct { Name ID Alteration TableAlteration Position Position // position of the "ALTER" token }
AlterTable represents an ALTER TABLE statement. https://cloud.google.com/spanner/docs/data-definition-language#alter_table
func (*AlterTable) Pos ¶
func (at *AlterTable) Pos() Position
func (AlterTable) SQL ¶
func (at AlterTable) SQL() string
func (*AlterTable) String ¶
func (at *AlterTable) String() string
type AlterWatch ¶
func (AlterWatch) SQL ¶
func (scsw AlterWatch) SQL() string
type ArithOp ¶
type ArithOp struct { Op ArithOperator LHS, RHS Expr // only RHS is set for Neg, Plus, BitNot }
type ArithOperator ¶
type ArithOperator int
const ( Neg ArithOperator = iota // unary - Plus // unary + BitNot // unary ~ Mul // * Div // / Concat // || Add // + Sub // - BitShl // << BitShr // >> BitAnd // & BitXor // ^ BitOr // | )
type AtTimeZoneExpr ¶
func (AtTimeZoneExpr) SQL ¶
func (aze AtTimeZoneExpr) SQL() string
type BytesLiteral ¶
type BytesLiteral string
BytesLiteral represents a bytes literal. https://cloud.google.com/spanner/docs/lexical#string-and-bytes-literals
func (BytesLiteral) SQL ¶
func (bl BytesLiteral) SQL() string
type Case ¶
type Case struct { Expr Expr WhenClauses []WhenClause ElseResult Expr }
type ChangeStreamAlteration ¶
type ChangeStreamAlteration interface { SQL() string // contains filtered or unexported methods }
type ChangeStreamOptions ¶
func (ChangeStreamOptions) SQL ¶
func (cso ChangeStreamOptions) SQL() string
type Check ¶
Check represents a check constraint as part of a CREATE TABLE or ALTER TABLE statement.
type ColumnAlteration ¶
type ColumnAlteration interface { SQL() string // contains filtered or unexported methods }
ColumnAlteration is satisfied by SetColumnType and SetColumnOptions.
type ColumnDef ¶
type ColumnDef struct { Name ID Type Type NotNull bool Default Expr // set if this column has a default value Generated Expr // set of this is a generated column Options ColumnOptions Position Position // position of the column name }
ColumnDef represents a column definition as part of a CREATE TABLE or ALTER TABLE statement.
type ColumnOptions ¶
type ColumnOptions struct { // AllowCommitTimestamp represents a column OPTIONS. // `true` if query is `OPTIONS (allow_commit_timestamp = true)` // `false` if query is `OPTIONS (allow_commit_timestamp = null)` // `nil` if there are no OPTIONS AllowCommitTimestamp *bool }
ColumnOptions represents options on a column as part of a CREATE TABLE or ALTER TABLE statement.
func (ColumnOptions) SQL ¶
func (co ColumnOptions) SQL() string
type Comment ¶
type Comment struct { Marker string // Opening marker; one of "#", "--", "/*". Isolated bool // Whether this comment is on its own line. // Start and End are the position of the opening and terminating marker. Start, End Position Text []string }
Comment represents a comment.
type ComparisonOp ¶
type ComparisonOp struct { Op ComparisonOperator LHS, RHS Expr // RHS2 is the third operand for BETWEEN. // "<LHS> BETWEEN <RHS> AND <RHS2>". RHS2 Expr }
func (ComparisonOp) SQL ¶
func (co ComparisonOp) SQL() string
type ComparisonOperator ¶
type ComparisonOperator int
const ( Lt ComparisonOperator = iota Le Gt Ge Eq Ne // both "!=" and "<>" Like NotLike Between NotBetween )
type Constraint ¶
type CreateChangeStream ¶
type CreateChangeStream struct { Name ID Watch []WatchDef WatchAllTables bool Options ChangeStreamOptions Position Position }
CreateChangeStream represents a CREATE CHANGE STREAM statement. https://cloud.google.com/spanner/docs/change-streams/manage
func (*CreateChangeStream) Pos ¶
func (cs *CreateChangeStream) Pos() Position
func (CreateChangeStream) SQL ¶
func (cs CreateChangeStream) SQL() string
func (*CreateChangeStream) String ¶
func (cs *CreateChangeStream) String() string
type CreateIndex ¶
type CreateIndex struct { Name ID Table ID Columns []KeyPart Unique bool NullFiltered bool IfNotExists bool Storing []ID Interleave ID Position Position // position of the "CREATE" token }
CreateIndex represents a CREATE INDEX statement. https://cloud.google.com/spanner/docs/data-definition-language#create-index
func (*CreateIndex) Pos ¶
func (ci *CreateIndex) Pos() Position
func (CreateIndex) SQL ¶
func (ci CreateIndex) SQL() string
func (*CreateIndex) String ¶
func (ci *CreateIndex) String() string
type CreateRole ¶
CreateRole represents a CREATE Role statement. https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#create_role
func (*CreateRole) Pos ¶
func (cr *CreateRole) Pos() Position
func (CreateRole) SQL ¶
func (cr CreateRole) SQL() string
func (*CreateRole) String ¶
func (cr *CreateRole) String() string
type CreateSequence ¶
type CreateSequence struct { Name ID IfNotExists bool Options SequenceOptions Position Position }
CreateSequence represents an ALTER SEQUENCE statement. https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#create-sequence
func (*CreateSequence) Pos ¶
func (cs *CreateSequence) Pos() Position
func (CreateSequence) SQL ¶
func (cs CreateSequence) SQL() string
func (*CreateSequence) String ¶
func (cs *CreateSequence) String() string
type CreateTable ¶
type CreateTable struct { Name ID IfNotExists bool Columns []ColumnDef Constraints []TableConstraint PrimaryKey []KeyPart Interleave *Interleave RowDeletionPolicy *RowDeletionPolicy Synonym ID // may be empty Position Position // position of the "CREATE" token }
CreateTable represents a CREATE TABLE statement. https://cloud.google.com/spanner/docs/data-definition-language#create_table
func (*CreateTable) Pos ¶
func (ct *CreateTable) Pos() Position
func (CreateTable) SQL ¶
func (ct CreateTable) SQL() string
func (*CreateTable) String ¶
func (ct *CreateTable) String() string
type CreateView ¶
type CreateView struct { Name ID OrReplace bool SecurityType SecurityType Query Query Position Position // position of the "CREATE" token }
CreateView represents a CREATE [OR REPLACE] VIEW statement. https://cloud.google.com/spanner/docs/data-definition-language#view_statements
func (*CreateView) Pos ¶
func (cv *CreateView) Pos() Position
func (CreateView) SQL ¶
func (cv CreateView) SQL() string
func (*CreateView) String ¶
func (cv *CreateView) String() string
type DDL ¶
type DDL struct { List []DDLStmt Filename string // if known at parse time Comments []*Comment // all comments, sorted by position }
DDL represents a Data Definition Language (DDL) file.
func ParseDDL ¶
ParseDDL parses a DDL file.
The provided filename is used for error reporting and will appear in the returned structure.
func (*DDL) InlineComment ¶
InlineComment returns the comment on the same line as a node, or nil if there's no inline comment. The returned comment is guaranteed to be a single line.
func (*DDL) LeadingComment ¶
LeadingComment returns the comment that immediately precedes a node, or nil if there's no such comment.
type DDLStmt ¶
DDLStmt is satisfied by a type that can appear in a DDL.
func ParseDDLStmt ¶
ParseDDLStmt parses a single DDL statement.
type DML ¶
type DML struct { List []DMLStmt Filename string // if known at parse time Comments []*Comment // all comments, sorted by position }
DML represents a Data Manipulation Language (DML) file.
func ParseDML ¶
ParseDML parses a DML file.
The provided filename is used for error reporting and will appear in the returned structure.
func (*DML) InlineComment ¶
InlineComment returns the comment on the same line as a node, or nil if there's no inline comment. The returned comment is guaranteed to be a single line.
func (*DML) LeadingComment ¶
LeadingComment returns the comment that immediately precedes a node, or nil if there's no such comment.
type DMLStmt ¶
type DMLStmt interface { SQL() string // contains filtered or unexported methods }
DMLStmt is satisfied by a type that is a DML statement.
func ParseDMLStmt ¶
ParseDMLStmt parses a single DML statement.
type DatabaseAlteration ¶
type DatabaseAlteration interface { SQL() string // contains filtered or unexported methods }
type DatabaseOptions ¶
type DatabaseOptions struct { OptimizerVersion *int OptimizerStatisticsPackage *string VersionRetentionPeriod *string EnableKeyVisualizer *bool DefaultLeader *string }
DatabaseOptions represents options on a database as part of a ALTER DATABASE statement.
func (DatabaseOptions) SQL ¶
func (do DatabaseOptions) SQL() string
type DateLiteral ¶
DateLiteral represents a date literal. https://cloud.google.com/spanner/docs/lexical#date_literals
func (DateLiteral) SQL ¶
func (dl DateLiteral) SQL() string
type Delete ¶
Delete represents a DELETE statement. https://cloud.google.com/spanner/docs/dml-syntax#delete-statement
type DropChangeStream ¶
DropChangeStream represents a DROP CHANGE STREAM statement.
func (*DropChangeStream) Pos ¶
func (dc *DropChangeStream) Pos() Position
func (DropChangeStream) SQL ¶
func (dc DropChangeStream) SQL() string
func (*DropChangeStream) String ¶
func (dc *DropChangeStream) String() string
type DropChangeStreamWatch ¶
type DropChangeStreamWatch struct{}
func (DropChangeStreamWatch) SQL ¶
func (dcsw DropChangeStreamWatch) SQL() string
type DropColumn ¶
type DropColumn struct{ Name ID }
func (DropColumn) SQL ¶
func (dc DropColumn) SQL() string
type DropConstraint ¶
type DropConstraint struct{ Name ID }
func (DropConstraint) SQL ¶
func (dc DropConstraint) SQL() string
type DropDefault ¶
type DropDefault struct{}
func (DropDefault) SQL ¶
func (dp DropDefault) SQL() string
type DropIndex ¶
DropIndex represents a DROP INDEX statement. https://cloud.google.com/spanner/docs/data-definition-language#drop-index
type DropRole ¶
DropRole represents a DROP ROLE statement. https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#drop_role
type DropRowDeletionPolicy ¶
type DropRowDeletionPolicy struct{}
func (DropRowDeletionPolicy) SQL ¶
func (drdp DropRowDeletionPolicy) SQL() string
type DropSequence ¶
DropSequence represents a DROP SEQUENCE statement. https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#drop-sequence
func (*DropSequence) Pos ¶
func (ds *DropSequence) Pos() Position
func (DropSequence) SQL ¶
func (do DropSequence) SQL() string
func (*DropSequence) String ¶
func (ds *DropSequence) String() string
type DropStoredColumn ¶
type DropStoredColumn struct{ Name ID }
func (DropStoredColumn) SQL ¶
func (dsc DropStoredColumn) SQL() string
type DropSynonym ¶
type DropSynonym struct{ Name ID }
func (DropSynonym) SQL ¶
func (ds DropSynonym) SQL() string
type DropTable ¶
DropTable represents a DROP TABLE statement. https://cloud.google.com/spanner/docs/data-definition-language#drop_table
type DropView ¶
DropView represents a DROP VIEW statement. https://cloud.google.com/spanner/docs/data-definition-language#drop-view
type ExtractExpr ¶
func (ExtractExpr) SQL ¶
func (ee ExtractExpr) SQL() string
type FloatLiteral ¶
type FloatLiteral float64
FloatLiteral represents a floating point literal. https://cloud.google.com/spanner/docs/lexical#floating-point-literals
func (FloatLiteral) SQL ¶
func (fl FloatLiteral) SQL() string
type ForeignKey ¶
type ForeignKey struct { Columns []ID RefTable ID RefColumns []ID OnDelete OnDelete Position Position // position of the "FOREIGN" token }
ForeignKey represents a foreign key definition as part of a CREATE TABLE or ALTER TABLE statement.
func (ForeignKey) Pos ¶
func (fk ForeignKey) Pos() Position
func (ForeignKey) SQL ¶
func (fk ForeignKey) SQL() string
type Func ¶
type Func struct { Name string // not ID Args []Expr Distinct bool NullsHandling NullsHandling Having *AggregateHaving }
Func represents a function call.
type GrantRole ¶
type GrantRole struct { ToRoleNames []ID GrantRoleNames []ID Privileges []Privilege TableNames []ID TvfNames []ID ViewNames []ID ChangeStreamNames []ID Position Position // position of the "GRANT" token }
GrantRole represents a GRANT statement. https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#grant_statement
type ID ¶
type ID string
ID represents an identifier. https://cloud.google.com/spanner/docs/lexical#identifiers
type IndexAlteration ¶
type IndexAlteration interface { SQL() string // contains filtered or unexported methods }
type Insert ¶
type Insert struct { Table ID Columns []ID Input ValuesOrSelect }
Insert represents an INSERT statement. https://cloud.google.com/spanner/docs/dml-syntax#insert-statement
type IntegerLiteral ¶
type IntegerLiteral int64
IntegerLiteral represents an integer literal. https://cloud.google.com/spanner/docs/lexical#integer-literals
func (IntegerLiteral) SQL ¶
func (il IntegerLiteral) SQL() string
type Interleave ¶
Interleave represents an interleave clause of a CREATE TABLE statement.
type IntervalExpr ¶
func (IntervalExpr) SQL ¶
func (ie IntervalExpr) SQL() string
type JSONLiteral ¶
type JSONLiteral []byte
JSONLiteral represents a JSON literal https://cloud.google.com/spanner/docs/reference/standard-sql/lexical#json_literals
func (JSONLiteral) SQL ¶
func (jl JSONLiteral) SQL() string
type KeyPart ¶
KeyPart represents a column specification as part of a primary key or index definition.
type LiteralOrParam ¶
type LiteralOrParam interface { SQL() string // contains filtered or unexported methods }
LiteralOrParam is implemented by integer literal and parameter values.
type LogicalOp ¶
type LogicalOp struct { Op LogicalOperator LHS, RHS BoolExpr // only RHS is set for Not }
type Node ¶
type Node interface {
Pos() Position
}
Node is implemented by concrete types in this package that represent things appearing in a DDL file.
type NullsHandling ¶
type NullsHandling int
NullsHandling represents the method of dealing with NULL values in aggregate functions.
const ( NullsHandlingUnspecified NullsHandling = iota RespectNulls IgnoreNulls )
type PathExp ¶
type PathExp []ID
PathExp represents a path expression.
The grammar for path expressions is not defined (see b/169017423 internally), so this captures the most common form only, namely a dotted sequence of identifiers.
type Position ¶
Position describes a source position in an input DDL file. It is only valid if the line number is positive.
type Privilege ¶
type Privilege struct { Type PrivilegeType Columns []ID }
Privilege represents privilege to grant or revoke.
type PrivilegeType ¶
type PrivilegeType int
const ( PrivilegeTypeSelect PrivilegeType = iota PrivilegeTypeInsert PrivilegeTypeUpdate PrivilegeTypeDelete )
func (PrivilegeType) SQL ¶
func (pt PrivilegeType) SQL() string
type Query ¶
type Query struct { Select Select Order []Order Limit, Offset LiteralOrParam }
Query represents a query statement. https://cloud.google.com/spanner/docs/query-syntax#sql-syntax
type RenameTable ¶
type RenameTable struct { TableRenameOps []TableRenameOp Position Position // position of the "RENAME" token }
RenameTable represents a RENAME TABLE statement.
func (*RenameTable) Pos ¶
func (rt *RenameTable) Pos() Position
func (RenameTable) SQL ¶
func (rt RenameTable) SQL() string
func (*RenameTable) String ¶
func (rt *RenameTable) String() string
type ReplaceRowDeletionPolicy ¶
type ReplaceRowDeletionPolicy struct{ RowDeletionPolicy RowDeletionPolicy }
func (ReplaceRowDeletionPolicy) SQL ¶
func (rrdp ReplaceRowDeletionPolicy) SQL() string
type RevokeRole ¶
type RevokeRole struct { FromRoleNames []ID RevokeRoleNames []ID Privileges []Privilege TableNames []ID TvfNames []ID ViewNames []ID ChangeStreamNames []ID Position Position // position of the "REVOKE" token }
RevokeRole represents a REVOKE statement. https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#revoke_statement
func (*RevokeRole) Pos ¶
func (rr *RevokeRole) Pos() Position
func (RevokeRole) SQL ¶
func (rr RevokeRole) SQL() string
func (*RevokeRole) String ¶
func (rr *RevokeRole) String() string
type RowDeletionPolicy ¶
RowDeletionPolicy represents an row deletion policy clause of a CREATE, ALTER TABLE statement.
func (RowDeletionPolicy) SQL ¶
func (rdp RowDeletionPolicy) SQL() string
type SecurityType ¶
type SecurityType int
const ( Invoker SecurityType = iota Definer )
func (SecurityType) SQL ¶
func (st SecurityType) SQL() string
type Select ¶
type Select struct { Distinct bool List []Expr From []SelectFrom Where BoolExpr GroupBy []Expr // When the FROM clause has TABLESAMPLE operators, // TableSamples will be populated 1:1 with From; // FROM clauses without will have a nil value. TableSamples []*TableSample // If the SELECT list has explicit aliases ("AS alias"), // ListAliases will be populated 1:1 with List; // aliases that are present will be non-empty. ListAliases []ID }
Select represents a SELECT statement. https://cloud.google.com/spanner/docs/query-syntax#select-list
type SelectFrom ¶
type SelectFrom interface { SQL() string // contains filtered or unexported methods }
SelectFrom represents the FROM clause of a SELECT. https://cloud.google.com/spanner/docs/query-syntax#from_clause
type SelectFromJoin ¶
type SelectFromJoin struct { Type JoinType LHS, RHS SelectFrom // Join condition. // At most one of {On,Using} may be set. On BoolExpr Using []ID // Hints are suggestions for how to evaluate a join. // https://cloud.google.com/spanner/docs/query-syntax#join-hints Hints map[string]string }
SelectFromJoin is a SelectFrom that joins two other SelectFroms. https://cloud.google.com/spanner/docs/query-syntax#join_types
func (SelectFromJoin) SQL ¶
func (sfj SelectFromJoin) SQL() string
type SelectFromTable ¶
SelectFromTable is a SelectFrom that specifies a table to read from.
func (SelectFromTable) SQL ¶
func (sft SelectFromTable) SQL() string
type SelectFromUnnest ¶
SelectFromUnnest is a SelectFrom that yields a virtual table from an array. https://cloud.google.com/spanner/docs/query-syntax#unnest
func (SelectFromUnnest) SQL ¶
func (sfu SelectFromUnnest) SQL() string
type SequenceAlteration ¶
type SequenceAlteration interface { SQL() string // contains filtered or unexported methods }
type SequenceExpr ¶
type SequenceExpr struct {
Name ID
}
func (SequenceExpr) SQL ¶
func (se SequenceExpr) SQL() string
type SequenceOptions ¶
type SequenceOptions struct { SequenceKind *string SkipRangeMin *int SkipRangeMax *int StartWithCounter *int }
SequenceOptions represents options on a sequence as part of a CREATE SEQUENCE and ALTER SEQUENCE statement.
func (SequenceOptions) SQL ¶
func (so SequenceOptions) SQL() string
type SetColumnOptions ¶
type SetColumnOptions struct{ Options ColumnOptions }
func (SetColumnOptions) SQL ¶
func (sco SetColumnOptions) SQL() string
type SetColumnType ¶
func (SetColumnType) SQL ¶
func (sct SetColumnType) SQL() string
type SetDatabaseOptions ¶
type SetDatabaseOptions struct{ Options DatabaseOptions }
func (SetDatabaseOptions) SQL ¶
func (sdo SetDatabaseOptions) SQL() string
type SetDefault ¶
type SetDefault struct {
Default Expr
}
func (SetDefault) SQL ¶
func (sd SetDefault) SQL() string
type SetOnDelete ¶
type SetOnDelete struct{ Action OnDelete }
func (SetOnDelete) SQL ¶
func (sod SetOnDelete) SQL() string
type SetSequenceOptions ¶
type SetSequenceOptions struct{ Options SequenceOptions }
func (SetSequenceOptions) SQL ¶
func (sa SetSequenceOptions) SQL() string
type SetStatisticsOptions ¶
type SetStatisticsOptions struct{ Options StatisticsOptions }
func (SetStatisticsOptions) SQL ¶
func (sso SetStatisticsOptions) SQL() string
type StatisticsAlteration ¶
type StatisticsAlteration interface { SQL() string // contains filtered or unexported methods }
type StatisticsOptions ¶
type StatisticsOptions struct {
AllowGC *bool
}
StatisticsOptions represents options on a statistics as part of a ALTER STATISTICS statement.
func (StatisticsOptions) SQL ¶
func (sa StatisticsOptions) SQL() string
type StringLiteral ¶
type StringLiteral string
StringLiteral represents a string literal. https://cloud.google.com/spanner/docs/lexical#string-and-bytes-literals
func (StringLiteral) SQL ¶
func (sl StringLiteral) SQL() string
type TableAlteration ¶
type TableAlteration interface { SQL() string // contains filtered or unexported methods }
TableAlteration is satisfied by AddColumn, DropColumn, AddConstraint, DropConstraint, SetOnDelete, AlterColumn, AddRowDeletionPolicy, ReplaceRowDeletionPolicy, DropRowDeletionPolicy, RenameTo, AddSynonym, and DropSynonym.
type TableConstraint ¶
type TableConstraint struct { Name ID // may be empty Constraint Constraint Position Position // position of the "CONSTRAINT" token, or Constraint.Pos() }
TableConstraint represents a constraint on a table.
func (TableConstraint) Pos ¶
func (tc TableConstraint) Pos() Position
func (TableConstraint) SQL ¶
func (tc TableConstraint) SQL() string
type TableRenameOp ¶
type TableSample ¶
type TableSample struct { Method TableSampleMethod Size Expr SizeType TableSampleSizeType }
type TableSampleMethod ¶
type TableSampleMethod int
const ( Bernoulli TableSampleMethod = iota Reservoir )
type TableSampleSizeType ¶
type TableSampleSizeType int
const ( PercentTableSample TableSampleSizeType = iota RowsTableSample )
type TimestampLiteral ¶
TimestampLiteral represents a timestamp literal. https://cloud.google.com/spanner/docs/lexical#timestamp_literals
func (TimestampLiteral) SQL ¶
func (tl TimestampLiteral) SQL() string
type Type ¶
type Type struct { Array bool Base TypeBase // Bool, Int64, Float64, Numeric, String, Bytes, Date, Timestamp Len int64 // if Base is String or Bytes; may be MaxLen }
Type represents a column type.
type TypedExpr ¶
TypedExpr represents a typed expression in the form `expr AS type_name`, e.g. `'17' AS INT64`.
type Update ¶
type Update struct { Table ID Items []UpdateItem Where BoolExpr }
Update represents an UPDATE statement. https://cloud.google.com/spanner/docs/dml-syntax#update-statement
type UpdateItem ¶
type Values ¶
type Values [][]Expr
Values represents one or more lists of expressions passed to an `INSERT` statement.
type ValuesOrSelect ¶
type ValuesOrSelect interface { SQL() string // contains filtered or unexported methods }