Documentation ¶
Index ¶
- Constants
- type Action
- type AddColumn
- type AddConstraint
- type AddRowDeletionPolicy
- type AlterColumnDataType
- type AlterColumnDropDefault
- type AlterColumnDropOptions
- type AlterColumnSetDefault
- type AlterColumnSetOptions
- type AlterConstraint
- type AlterTableAction
- type AlterTableStmt
- type CheckConstraint
- type Column
- type ColumnIdent
- type Constraint
- type Constraints
- type CreateIndexStmt
- type CreateTableStmt
- type DDL
- type DataType
- type Default
- type DiffCreateTableConfig
- type DiffCreateTableOption
- type DropColumn
- type DropConstraint
- type DropIndexStmt
- type DropRowDeletionPolicy
- type DropTableStmt
- type Expr
- type ForeignKeyConstraint
- type Ident
- type IndexConstraint
- type Lexer
- type Literal
- type Object
- type ObjectName
- type Option
- type Options
- type Order
- type Parser
- type RenameColumn
- type RenameConstraint
- type RenameTable
- type ReplaceRowDeletionPolicy
- type Stmt
- type Token
- type TokenType
- type Verb
Constants ¶
const ( Dialect = "spanner" DriverName = "spanner" Indent = " " CommentPrefix = "-- " )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddColumn ¶
type AddColumn struct {
Column *Column
}
AddColumn represents ALTER TABLE table_name ADD COLUMN.
type AddConstraint ¶
type AddConstraint struct { Constraint Constraint NotValid bool }
AddConstraint represents ALTER TABLE table_name ADD CONSTRAINT.
func (*AddConstraint) GoString ¶
func (s *AddConstraint) GoString() string
type AddRowDeletionPolicy ¶ added in v0.0.16
type AddRowDeletionPolicy struct {
RowDeletionPolicy *Option
}
AddRowDeletionPolicy represents ALTER TABLE table_name ADD ROW DELETION POLICY.
func (*AddRowDeletionPolicy) GoString ¶ added in v0.0.16
func (s *AddRowDeletionPolicy) GoString() string
type AlterColumnDataType ¶
AlterColumnDataType represents ALTER TABLE table_name ALTER COLUMN column_name data_type NOT NULL.
func (*AlterColumnDataType) GoString ¶
func (s *AlterColumnDataType) GoString() string
type AlterColumnDropDefault ¶
type AlterColumnDropDefault struct {
Name *Ident
}
AlterColumnDropDefault represents ALTER TABLE table_name ALTER COLUMN column_name DROP DEFAULT.
func (*AlterColumnDropDefault) GoString ¶
func (s *AlterColumnDropDefault) GoString() string
type AlterColumnDropOptions ¶
type AlterColumnDropOptions struct {
Name *Ident
}
AlterColumnDropOptions represents ALTER TABLE table_name ALTER COLUMN column_name DROP OPTIONS.
func (*AlterColumnDropOptions) GoString ¶
func (s *AlterColumnDropOptions) GoString() string
type AlterColumnSetDefault ¶
AlterColumnSetDefault represents ALTER TABLE table_name ALTER COLUMN column_name SET DEFAULT.
func (*AlterColumnSetDefault) GoString ¶
func (s *AlterColumnSetDefault) GoString() string
type AlterColumnSetOptions ¶
AlterColumnSetOptions represents ALTER TABLE table_name ALTER COLUMN column_name SET OPTIONS.
func (*AlterColumnSetOptions) GoString ¶
func (s *AlterColumnSetOptions) GoString() string
type AlterConstraint ¶
AlterConstraint represents ALTER TABLE table_name ALTER CONSTRAINT.
func (*AlterConstraint) GoString ¶
func (s *AlterConstraint) GoString() string
type AlterTableAction ¶
type AlterTableAction interface { GoString() string // contains filtered or unexported methods }
type AlterTableStmt ¶
type AlterTableStmt struct { Comment string Indent string Name *ObjectName Action AlterTableAction }
func (*AlterTableStmt) GetNameForDiff ¶
func (s *AlterTableStmt) GetNameForDiff() string
func (*AlterTableStmt) GoString ¶
func (s *AlterTableStmt) GoString() string
func (*AlterTableStmt) String ¶
func (s *AlterTableStmt) String() string
type CheckConstraint ¶
CheckConstraint represents a CHECK constraint.
func (*CheckConstraint) GetName ¶
func (c *CheckConstraint) GetName() *Ident
func (*CheckConstraint) GoString ¶
func (c *CheckConstraint) GoString() string
func (*CheckConstraint) String ¶
func (c *CheckConstraint) String() string
func (*CheckConstraint) StringForDiff ¶
func (c *CheckConstraint) StringForDiff() string
type ColumnIdent ¶
func (*ColumnIdent) GoString ¶
func (i *ColumnIdent) GoString() string
func (*ColumnIdent) String ¶
func (i *ColumnIdent) String() string
func (*ColumnIdent) StringForDiff ¶
func (i *ColumnIdent) StringForDiff() string
type Constraint ¶
type Constraints ¶
type Constraints []Constraint
func (Constraints) Append ¶
func (constraints Constraints) Append(constraint Constraint) Constraints
type CreateIndexStmt ¶
type CreateIndexStmt struct { Comment string Unique bool IfNotExists bool Name *ObjectName TableName *ObjectName Using []*Ident Columns []*ColumnIdent }
func (*CreateIndexStmt) GetNameForDiff ¶
func (s *CreateIndexStmt) GetNameForDiff() string
func (*CreateIndexStmt) GoString ¶
func (s *CreateIndexStmt) GoString() string
func (*CreateIndexStmt) String ¶
func (s *CreateIndexStmt) String() string
func (*CreateIndexStmt) StringForDiff ¶
func (s *CreateIndexStmt) StringForDiff() string
type CreateTableStmt ¶
type CreateTableStmt struct { Comment string Indent string IfNotExists bool Name *ObjectName Columns []*Column Constraints Constraints Options Options RowDeletionPolicy *Option }
func (*CreateTableStmt) GetNameForDiff ¶
func (s *CreateTableStmt) GetNameForDiff() string
func (*CreateTableStmt) GoString ¶
func (s *CreateTableStmt) GoString() string
func (*CreateTableStmt) String ¶
func (s *CreateTableStmt) String() string
type DDL ¶
type DDL struct {
Stmts []Stmt
}
func DiffCreateTable ¶
func DiffCreateTable(before, after *CreateTableStmt, opts ...DiffCreateTableOption) (*DDL, error)
type DataType ¶
func (*DataType) StringForDiff ¶
type DiffCreateTableConfig ¶
type DiffCreateTableConfig struct {
UseAlterTableAddConstraintNotValid bool
}
type DiffCreateTableOption ¶
type DiffCreateTableOption interface {
// contains filtered or unexported methods
}
func DiffCreateTableUseAlterTableAddConstraintNotValid ¶
func DiffCreateTableUseAlterTableAddConstraintNotValid(notValid bool) DiffCreateTableOption
type DropColumn ¶
type DropColumn struct {
Name *Ident
}
DropColumn represents ALTER TABLE table_name DROP COLUMN.
func (*DropColumn) GoString ¶
func (s *DropColumn) GoString() string
type DropConstraint ¶
type DropConstraint struct {
Name *Ident
}
DropConstraint represents ALTER TABLE table_name DROP CONSTRAINT.
func (*DropConstraint) GoString ¶
func (s *DropConstraint) GoString() string
type DropIndexStmt ¶
type DropIndexStmt struct { Comment string IfExists bool Name *ObjectName }
func (*DropIndexStmt) GetNameForDiff ¶
func (s *DropIndexStmt) GetNameForDiff() string
func (*DropIndexStmt) GoString ¶
func (s *DropIndexStmt) GoString() string
func (*DropIndexStmt) String ¶
func (s *DropIndexStmt) String() string
type DropRowDeletionPolicy ¶ added in v0.0.16
type DropRowDeletionPolicy struct{}
DropRowDeletionPolicy represents ALTER TABLE table_name DROP ROW DELETION POLICY.
func (*DropRowDeletionPolicy) GoString ¶ added in v0.0.16
func (s *DropRowDeletionPolicy) GoString() string
type DropTableStmt ¶
type DropTableStmt struct { Comment string IfExists bool Name *ObjectName }
func (*DropTableStmt) GetNameForDiff ¶
func (s *DropTableStmt) GetNameForDiff() string
func (*DropTableStmt) GoString ¶
func (s *DropTableStmt) GoString() string
func (*DropTableStmt) String ¶
func (s *DropTableStmt) String() string
type ForeignKeyConstraint ¶
type ForeignKeyConstraint struct { Name *Ident Columns []*ColumnIdent Ref *Ident RefColumns []*ColumnIdent }
ForeignKeyConstraint represents a FOREIGN KEY constraint.
func (*ForeignKeyConstraint) GetName ¶
func (c *ForeignKeyConstraint) GetName() *Ident
func (*ForeignKeyConstraint) GoString ¶
func (c *ForeignKeyConstraint) GoString() string
func (*ForeignKeyConstraint) String ¶
func (c *ForeignKeyConstraint) String() string
func (*ForeignKeyConstraint) StringForDiff ¶
func (c *ForeignKeyConstraint) StringForDiff() string
type IndexConstraint ¶
type IndexConstraint struct { Name *Ident Unique bool //diff:ignore-line-postgres-cockroach Columns []*ColumnIdent }
IndexConstraint represents a UNIQUE constraint. //diff:ignore-line-postgres-cockroach.
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer はSQL文をトークンに分割するレキサーです。
type ObjectName ¶
func NewObjectName ¶
func NewObjectName(name string) *ObjectName
func (*ObjectName) String ¶
func (t *ObjectName) String() string
func (*ObjectName) StringForDiff ¶
func (t *ObjectName) StringForDiff() string
type Option ¶
func (*Option) StringForDiff ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser はSQL文を解析するパーサーです。
type RenameColumn ¶
RenameColumn represents ALTER TABLE table_name RENAME COLUMN.
func (*RenameColumn) GoString ¶
func (s *RenameColumn) GoString() string
type RenameConstraint ¶
RenameConstraint represents ALTER TABLE table_name RENAME COLUMN.
func (*RenameConstraint) GoString ¶
func (s *RenameConstraint) GoString() string
type RenameTable ¶
type RenameTable struct {
NewName *ObjectName
}
RenameTable represents ALTER TABLE table_name RENAME TO new_table_name.
func (*RenameTable) GoString ¶
func (s *RenameTable) GoString() string
type ReplaceRowDeletionPolicy ¶ added in v0.0.16
type ReplaceRowDeletionPolicy struct {
RowDeletionPolicy *Option
}
ReplaceRowDeletionPolicy represents ALTER TABLE table_name REPLACE ROW DELETION POLICY.
func (*ReplaceRowDeletionPolicy) GoString ¶ added in v0.0.16
func (s *ReplaceRowDeletionPolicy) GoString() string
type TokenType ¶
type TokenType string
const ( // SPECIAL TOKENS. TOKEN_ILLEGAL TokenType = "ILLEGAL" TOKEN_EOF TokenType = "EOF" // SPECIAL CHARACTERS. TOKEN_OPEN_PAREN TokenType = "OPEN_PAREN" // ( TOKEN_CLOSE_PAREN TokenType = "CLOSE_PAREN" // ) TOKEN_COMMA TokenType = "COMMA" // , TOKEN_SEMICOLON TokenType = "SEMICOLON" // ; TOKEN_EQUAL TokenType = "EQUAL" // = TOKEN_GREATER TokenType = "GREATER" // > TOKEN_LESS TokenType = "LESS" // < TOKEN_PLUS TokenType = "PLUS" // + TOKEN_MINUS TokenType = "MINUS" // - TOKEN_ASTERISK TokenType = "ASTERISK" // * TOKEN_SLASH TokenType = "SLASH" // / TOKEN_STRING_CONCAT TokenType = "STRING_CONCAT" //nolint:gosec // || TOKEN_TYPECAST TokenType = "TYPECAST" // :: TOKEN_TYPE_ANNOTATION TokenType = "TYPE_ANNOTATION" // ::: //diff:ignore-line-postgres-cockroach // VERB. TOKEN_CREATE TokenType = "CREATE" TOKEN_ALTER TokenType = "ALTER" TOKEN_DROP TokenType = "DROP" TOKEN_RENAME TokenType = "RENAME" TOKEN_TRUNCATE TokenType = "TRUNCATE" TOKEN_DELETE TokenType = "DELETE" TOKEN_UPDATE TokenType = "UPDATE" // OBJECT. TOKEN_TABLE TokenType = "TABLE" TOKEN_INDEX TokenType = "INDEX" TOKEN_VIEW TokenType = "VIEW" // OTHER. TOKEN_IF TokenType = "IF" TOKEN_EXISTS TokenType = "EXISTS" TOKEN_USING TokenType = "USING" TOKEN_ON TokenType = "ON" TOKEN_TO TokenType = "TO" TOKEN_WITH TokenType = "WITH" // DATA TYPE. TOKEN_BOOL TokenType = "BOOL" //diff:ignore-line-postgres-cockroach TOKEN_INT64 TokenType = "INT64" //diff:ignore-line-postgres-cockroach TOKEN_FLOAT64 TokenType = "FLOAT64" TOKEN_NUMERIC TokenType = "NUMERIC" TOKEN_JSON TokenType = "JSON" TOKEN_STRING TokenType = "STRING" //diff:ignore-line-postgres-cockroach TOKEN_BYTES TokenType = "BYTES" TOKEN_TIMESTAMP TokenType = "TIMESTAMP" TOKEN_DATE TokenType = "DATE" TOKEN_ARRAY TokenType = "ARRAY" TOKEN_STRUCT TokenType = "STRUCT" // COLUMN. TOKEN_DEFAULT TokenType = "DEFAULT" TOKEN_NOT TokenType = "NOT" TOKEN_ASC TokenType = "ASC" TOKEN_DESC TokenType = "DESC" TOKEN_OPTIONS TokenType = "OPTIONS" TOKEN_INTERLEAVE TokenType = "INTERLEAVE" TOKEN_IN TokenType = "IN" TOKEN_PARENT TokenType = "PARENT" TOKEN_CASCADE TokenType = "CASCADE" TOKEN_NO TokenType = "NO" TOKEN_ACTION TokenType = "ACTION" // CONSTRAINT. TOKEN_CONSTRAINT TokenType = "CONSTRAINT" TOKEN_PRIMARY TokenType = "PRIMARY" TOKEN_KEY TokenType = "KEY" TOKEN_FOREIGN TokenType = "FOREIGN" TOKEN_REFERENCES TokenType = "REFERENCES" TOKEN_UNIQUE TokenType = "UNIQUE" TOKEN_CHECK TokenType = "CHECK" // FUNCTION. TOKEN_NULLIF TokenType = "NULLIF" // VALUE. TOKEN_NULL TokenType = "NULL" TOKEN_TRUE TokenType = "TRUE" TOKEN_FALSE TokenType = "FALSE" // OPTION TOKEN_ROW TokenType = "ROW" TOKEN_DELETION TokenType = "DELETION" TOKEN_POLICY TokenType = "POLICY" TOKEN_OLDER_THAN TokenType = "OLDER_THAN" TOKEN_INTERVAL TokenType = "INTERVAL" TOKEN_DAY TokenType = "DAY" // IDENTIFIER. TOKEN_IDENT TokenType = "IDENT" )