vrepl

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

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

func NewColumns(names []string) []Column

NewColumns creates a new column array from non empty names

func ParseColumns

func ParseColumns(names string) []Column

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

func (l *ColumnList) Len() int

Len returns the length of this list

func (*ColumnList) Names

func (l *ColumnList) Names() []string

Names returns list of column names

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

type ColumnsMap map[string]int

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

type UniqueKey

type UniqueKey struct {
	Name            string
	Columns         ColumnList
	HasNullable     bool
	IsAutoIncrement bool
}

UniqueKey is the combination of a key's name and columns

func (*UniqueKey) IsPrimary

func (k *UniqueKey) IsPrimary() bool

IsPrimary checks if this unique key is primary

func (*UniqueKey) Len

func (k *UniqueKey) Len() int

Len returns the length of this list

func (*UniqueKey) String

func (k *UniqueKey) String() string

String returns a visual representation of this key

Jump to

Keyboard shortcuts

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