Documentation ¶
Index ¶
- type AlterTableParser
- func (p *AlterTableParser) ColumnRenameMap() map[string]string
- func (p *AlterTableParser) DroppedColumnsMap() map[string]bool
- func (p *AlterTableParser) GetAlterStatementOptions() string
- func (p *AlterTableParser) GetExplicitSchema() string
- func (p *AlterTableParser) GetExplicitTable() string
- func (p *AlterTableParser) GetNonTrivialRenames() map[string]string
- func (p *AlterTableParser) HasExplicitSchema() bool
- func (p *AlterTableParser) HasExplicitTable() bool
- func (p *AlterTableParser) HasNonTrivialRenames() bool
- func (p *AlterTableParser) IsAutoIncrementDefined() bool
- func (p *AlterTableParser) IsRenameTable() bool
- func (p *AlterTableParser) ParseAlterStatement(alterStatement string) (err error)
- type Column
- type ColumnList
- func (l *ColumnList) Columns() []Column
- func (l *ColumnList) Equals(other *ColumnList) bool
- func (l *ColumnList) EqualsByNames(other *ColumnList) bool
- func (l *ColumnList) GetCharset(columnName string) string
- func (l *ColumnList) GetColumn(columnName string) *Column
- func (l *ColumnList) GetColumnType(columnName string) ColumnType
- func (l *ColumnList) HasTimezoneConversion(columnName string) bool
- func (l *ColumnList) IsSubsetOf(other *ColumnList) bool
- func (l *ColumnList) IsUnsigned(columnName string) bool
- func (l *ColumnList) Len() int
- func (l *ColumnList) Names() []string
- func (l *ColumnList) SetCharset(columnName string, charset string)
- func (l *ColumnList) SetColumnType(columnName string, columnType ColumnType)
- func (l *ColumnList) SetConvertDatetimeToTimestamp(columnName string, toTimezone string)
- func (l *ColumnList) SetUnsigned(columnName string)
- func (l *ColumnList) String() string
- type ColumnType
- type ColumnsMap
- type TimezoneConversion
- type UniqueKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlterTableParser ¶
type AlterTableParser struct {
// contains filtered or unexported fields
}
AlterTableParser is a parser tool for ALTER TABLE statements This is imported from gh-ost. In the future, we should replace that with Vitess parsing.
func NewAlterTableParser ¶
func NewAlterTableParser() *AlterTableParser
NewAlterTableParser creates a new parser
func NewParserFromAlterStatement ¶
func NewParserFromAlterStatement(alterStatement string) *AlterTableParser
NewParserFromAlterStatement creates a new parser with a ALTER TABLE statement
func (*AlterTableParser) ColumnRenameMap ¶
func (p *AlterTableParser) ColumnRenameMap() map[string]string
ColumnRenameMap returns the renamed column mapping
func (*AlterTableParser) DroppedColumnsMap ¶
func (p *AlterTableParser) DroppedColumnsMap() map[string]bool
DroppedColumnsMap returns list of dropped columns
func (*AlterTableParser) GetAlterStatementOptions ¶
func (p *AlterTableParser) GetAlterStatementOptions() string
GetAlterStatementOptions returns the options section in the ALTER TABLE statement
func (*AlterTableParser) GetExplicitSchema ¶
func (p *AlterTableParser) GetExplicitSchema() string
GetExplicitSchema returns the explciit schema, if defined
func (*AlterTableParser) GetExplicitTable ¶
func (p *AlterTableParser) GetExplicitTable() string
GetExplicitTable return the table name
func (*AlterTableParser) GetNonTrivialRenames ¶
func (p *AlterTableParser) GetNonTrivialRenames() map[string]string
GetNonTrivialRenames gets a list of renamed column
func (*AlterTableParser) HasExplicitSchema ¶
func (p *AlterTableParser) HasExplicitSchema() bool
HasExplicitSchema returns true when the ALTER TABLE statement includes the schema qualifier
func (*AlterTableParser) HasExplicitTable ¶
func (p *AlterTableParser) HasExplicitTable() bool
HasExplicitTable checks if the ALTER TABLE statement has an explicit table name
func (*AlterTableParser) HasNonTrivialRenames ¶
func (p *AlterTableParser) HasNonTrivialRenames() bool
HasNonTrivialRenames is true when columns have been renamed
func (*AlterTableParser) IsAutoIncrementDefined ¶
func (p *AlterTableParser) IsAutoIncrementDefined() bool
IsAutoIncrementDefined returns true when alter options include an explicit AUTO_INCREMENT value
func (*AlterTableParser) IsRenameTable ¶
func (p *AlterTableParser) IsRenameTable() bool
IsRenameTable returns true when the ALTER TABLE statement inclusdes renaming the table
func (*AlterTableParser) ParseAlterStatement ¶
func (p *AlterTableParser) ParseAlterStatement(alterStatement string) (err error)
ParseAlterStatement is the main function of th eparser, and parses an ALTER TABLE statement
type Column ¶
type Column struct { Name string IsUnsigned bool Charset string Type ColumnType // contains filtered or unexported fields }
Column represents a table column
func NewColumns ¶
NewColumns creates a new column array from non empty names
func ParseColumns ¶
ParseColumns creates a new column array fby parsing comma delimited names list
type ColumnList ¶
type ColumnList struct { Ordinals ColumnsMap // contains filtered or unexported fields }
ColumnList makes for a named list of columns
func NewColumnList ¶
func NewColumnList(names []string) *ColumnList
NewColumnList creates an object given ordered list of column names
func ParseColumnList ¶
func ParseColumnList(names string) *ColumnList
ParseColumnList parses a comma delimited list of column names
func (*ColumnList) Columns ¶
func (l *ColumnList) Columns() []Column
Columns returns the list of columns
func (*ColumnList) Equals ¶
func (l *ColumnList) Equals(other *ColumnList) bool
Equals checks for complete (deep) identities of columns, in order.
func (*ColumnList) EqualsByNames ¶
func (l *ColumnList) EqualsByNames(other *ColumnList) bool
EqualsByNames chcks if the names in this list equals the names of another list, in order. Type is ignored.
func (*ColumnList) GetCharset ¶
func (l *ColumnList) GetCharset(columnName string) string
GetCharset returns the hcarset property
func (*ColumnList) GetColumn ¶
func (l *ColumnList) GetColumn(columnName string) *Column
GetColumn gets a column by name
func (*ColumnList) GetColumnType ¶
func (l *ColumnList) GetColumnType(columnName string) ColumnType
GetColumnType gets type of column, for interesting types
func (*ColumnList) HasTimezoneConversion ¶
func (l *ColumnList) HasTimezoneConversion(columnName string) bool
HasTimezoneConversion sees if there's timezone conversion defined (only applicable to temporal values)
func (*ColumnList) IsSubsetOf ¶
func (l *ColumnList) IsSubsetOf(other *ColumnList) bool
IsSubsetOf returns 'true' when column names of this list are a subset of another list, in arbitrary order (order agnostic)
func (*ColumnList) IsUnsigned ¶
func (l *ColumnList) IsUnsigned(columnName string) bool
IsUnsigned returns true when the column is an unsigned numeral
func (*ColumnList) SetCharset ¶
func (l *ColumnList) SetCharset(columnName string, charset string)
SetCharset sets the charset property
func (*ColumnList) SetColumnType ¶
func (l *ColumnList) SetColumnType(columnName string, columnType ColumnType)
SetColumnType sets the type of the column (for interesting types)
func (*ColumnList) SetConvertDatetimeToTimestamp ¶
func (l *ColumnList) SetConvertDatetimeToTimestamp(columnName string, toTimezone string)
SetConvertDatetimeToTimestamp sets the timezone conversion
func (*ColumnList) SetUnsigned ¶
func (l *ColumnList) SetUnsigned(columnName string)
SetUnsigned toggles on the unsigned property
func (*ColumnList) String ¶
func (l *ColumnList) String() string
String returns a comma separated list of column names
type ColumnType ¶
type ColumnType int
ColumnType enumerates some important column types
const ( UnknownColumnType ColumnType = iota TimestampColumnType DateTimeColumnType EnumColumnType MediumIntColumnType JSONColumnType FloatColumnType )
type ColumnsMap ¶
ColumnsMap maps a column name onto its ordinal position
func NewColumnsMap ¶
func NewColumnsMap(orderedColumns []Column) ColumnsMap
NewColumnsMap creates a column map based on ordered list of columns
func NewEmptyColumnsMap ¶
func NewEmptyColumnsMap() ColumnsMap
NewEmptyColumnsMap creates an empty map
type TimezoneConversion ¶
type TimezoneConversion struct {
ToTimezone string
}
TimezoneConversion indicates how to convert a timezone value