Documentation ¶
Index ¶
- func BuildDMLDeleteQuery(databaseName, tableName string, tableColumns, uniqueKeyColumns *ColumnList, ...) (result string, uniqueKeyArgs []interface{}, err error)
- func BuildDMLInsertQuery(databaseName, tableName string, ...) (result string, sharedArgs []interface{}, err error)
- func BuildDMLUpdateQuery(databaseName, tableName string, ...) (result string, sharedArgs, uniqueKeyArgs []interface{}, err error)
- func BuildEqualsComparison(columns []string, values []string) (result string, err error)
- func BuildEqualsPreparedComparison(columns []string) (result string, err error)
- func BuildRangeComparison(columns []string, values []string, args []interface{}, ...) (result string, explodedArgs []interface{}, err error)
- func BuildRangeInsertPreparedQuery(databaseName, originalTableName, ghostTableName string, sharedColumns []string, ...) (result string, explodedArgs []interface{}, err error)
- func BuildRangeInsertQuery(databaseName, originalTableName, ghostTableName string, sharedColumns []string, ...) (result string, explodedArgs []interface{}, err error)
- func BuildRangePreparedComparison(columns *ColumnList, args []interface{}, comparisonSign ValueComparisonSign) (result string, explodedArgs []interface{}, err error)
- func BuildSetPreparedClause(columns *ColumnList) (result string, err error)
- func BuildUniqueKeyMaxValuesPreparedQuery(databaseName, tableName string, uniqueKeyColumns *ColumnList) (string, error)
- func BuildUniqueKeyMinValuesPreparedQuery(databaseName, tableName string, uniqueKeyColumns *ColumnList) (string, error)
- func BuildUniqueKeyRangeEndPreparedQueryViaOffset(databaseName, tableName string, uniqueKeyColumns *ColumnList, ...) (result string, explodedArgs []interface{}, err error)
- func BuildUniqueKeyRangeEndPreparedQueryViaTemptable(databaseName, tableName string, uniqueKeyColumns *ColumnList, ...) (result string, explodedArgs []interface{}, err error)
- func BuildValueComparison(column string, value string, comparisonSign ValueComparisonSign) (result string, err error)
- func EscapeName(name string) string
- type Column
- type ColumnList
- func (this *ColumnList) Columns() []Column
- func (this *ColumnList) Equals(other *ColumnList) bool
- func (this *ColumnList) EqualsByNames(other *ColumnList) bool
- func (this *ColumnList) GetCharset(columnName string) string
- func (this *ColumnList) GetColumn(columnName string) *Column
- func (this *ColumnList) GetColumnType(columnName string) ColumnType
- func (this *ColumnList) HasTimezoneConversion(columnName string) bool
- func (this *ColumnList) IsSubsetOf(other *ColumnList) bool
- func (this *ColumnList) IsUnsigned(columnName string) bool
- func (this *ColumnList) Len() int
- func (this *ColumnList) Names() []string
- func (this *ColumnList) SetCharset(columnName string, charset string)
- func (this *ColumnList) SetColumnType(columnName string, columnType ColumnType)
- func (this *ColumnList) SetConvertDatetimeToTimestamp(columnName string, toTimezone string)
- func (this *ColumnList) SetUnsigned(columnName string)
- func (this *ColumnList) String() string
- type ColumnType
- type ColumnValues
- type ColumnsMap
- type Parser
- type TimezoneConversion
- type UniqueKey
- type ValueComparisonSign
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDMLDeleteQuery ¶
func BuildDMLDeleteQuery(databaseName, tableName string, tableColumns, uniqueKeyColumns *ColumnList, args []interface{}) (result string, uniqueKeyArgs []interface{}, err error)
func BuildDMLInsertQuery ¶
func BuildDMLInsertQuery(databaseName, tableName string, tableColumns, sharedColumns, mappedSharedColumns *ColumnList, args []interface{}) (result string, sharedArgs []interface{}, err error)
func BuildDMLUpdateQuery ¶
func BuildDMLUpdateQuery(databaseName, tableName string, tableColumns, sharedColumns, mappedSharedColumns, uniqueKeyColumns *ColumnList, valueArgs, whereArgs []interface{}) (result string, sharedArgs, uniqueKeyArgs []interface{}, err error)
func BuildEqualsComparison ¶
func BuildRangeComparison ¶
func BuildRangeComparison(columns []string, values []string, args []interface{}, comparisonSign ValueComparisonSign) (result string, explodedArgs []interface{}, err error)
func BuildRangeInsertPreparedQuery ¶
func BuildRangeInsertPreparedQuery(databaseName, originalTableName, ghostTableName string, sharedColumns []string, mappedSharedColumns []string, uniqueKey string, uniqueKeyColumns *ColumnList, rangeStartArgs, rangeEndArgs []interface{}, includeRangeStartValues bool, transactionalTable bool) (result string, explodedArgs []interface{}, err error)
func BuildRangeInsertQuery ¶
func BuildRangeInsertQuery(databaseName, originalTableName, ghostTableName string, sharedColumns []string, mappedSharedColumns []string, uniqueKey string, uniqueKeyColumns *ColumnList, rangeStartValues, rangeEndValues []string, rangeStartArgs, rangeEndArgs []interface{}, includeRangeStartValues bool, transactionalTable bool) (result string, explodedArgs []interface{}, err error)
func BuildRangePreparedComparison ¶
func BuildRangePreparedComparison(columns *ColumnList, args []interface{}, comparisonSign ValueComparisonSign) (result string, explodedArgs []interface{}, err error)
func BuildSetPreparedClause ¶
func BuildSetPreparedClause(columns *ColumnList) (result string, err error)
func BuildUniqueKeyMaxValuesPreparedQuery ¶
func BuildUniqueKeyMaxValuesPreparedQuery(databaseName, tableName string, uniqueKeyColumns *ColumnList) (string, error)
func BuildUniqueKeyMinValuesPreparedQuery ¶
func BuildUniqueKeyMinValuesPreparedQuery(databaseName, tableName string, uniqueKeyColumns *ColumnList) (string, error)
func BuildValueComparison ¶
func BuildValueComparison(column string, value string, comparisonSign ValueComparisonSign) (result string, err error)
func EscapeName ¶
EscapeName will escape a db/table/column/... name by wrapping with backticks. It is not fool proof. I'm just trying to do the right thing here, not solving SQL injection issues, which should be irrelevant for this tool.
Types ¶
type Column ¶
type Column struct { Name string IsUnsigned bool Charset string Type ColumnType // contains filtered or unexported fields }
func NewColumns ¶
func ParseColumns ¶
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 (this *ColumnList) Columns() []Column
func (*ColumnList) Equals ¶
func (this *ColumnList) Equals(other *ColumnList) bool
func (*ColumnList) EqualsByNames ¶
func (this *ColumnList) EqualsByNames(other *ColumnList) bool
func (*ColumnList) GetCharset ¶
func (this *ColumnList) GetCharset(columnName string) string
func (*ColumnList) GetColumn ¶
func (this *ColumnList) GetColumn(columnName string) *Column
func (*ColumnList) GetColumnType ¶
func (this *ColumnList) GetColumnType(columnName string) ColumnType
func (*ColumnList) HasTimezoneConversion ¶
func (this *ColumnList) HasTimezoneConversion(columnName string) bool
func (*ColumnList) IsSubsetOf ¶
func (this *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 (this *ColumnList) IsUnsigned(columnName string) bool
func (*ColumnList) Len ¶
func (this *ColumnList) Len() int
func (*ColumnList) Names ¶
func (this *ColumnList) Names() []string
func (*ColumnList) SetCharset ¶
func (this *ColumnList) SetCharset(columnName string, charset string)
func (*ColumnList) SetColumnType ¶
func (this *ColumnList) SetColumnType(columnName string, columnType ColumnType)
func (*ColumnList) SetConvertDatetimeToTimestamp ¶
func (this *ColumnList) SetConvertDatetimeToTimestamp(columnName string, toTimezone string)
func (*ColumnList) SetUnsigned ¶
func (this *ColumnList) SetUnsigned(columnName string)
func (*ColumnList) String ¶
func (this *ColumnList) String() string
type ColumnType ¶
type ColumnType int
const ( UnknownColumnType ColumnType = iota TimestampColumnType DateTimeColumnType EnumColumnType MediumIntColumnType JSONColumnType FloatColumnType )
type ColumnValues ¶
type ColumnValues struct { ValuesPointers []interface{} // contains filtered or unexported fields }
func NewColumnValues ¶
func NewColumnValues(length int) *ColumnValues
func ToColumnValues ¶
func ToColumnValues(abstractValues []interface{}) *ColumnValues
func (*ColumnValues) AbstractValues ¶
func (this *ColumnValues) AbstractValues() []interface{}
func (*ColumnValues) String ¶
func (this *ColumnValues) String() string
func (*ColumnValues) StringColumn ¶
func (this *ColumnValues) StringColumn(index int) string
type ColumnsMap ¶
ColumnsMap maps a column name onto its ordinal position
func NewColumnsMap ¶
func NewColumnsMap(orderedColumns []Column) ColumnsMap
func NewEmptyColumnsMap ¶
func NewEmptyColumnsMap() ColumnsMap
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) DroppedColumnsMap ¶
func (*Parser) GetNonTrivialRenames ¶
func (*Parser) HasNonTrivialRenames ¶
func (*Parser) IsRenameTable ¶
func (*Parser) ParseAlterStatement ¶
type TimezoneConversion ¶
type TimezoneConversion struct {
ToTimezone string
}
type UniqueKey ¶
type UniqueKey struct { Name string Columns ColumnList HasNullable bool IsAutoIncrement bool }
UniqueKey is the combination of a key's name and columns
type ValueComparisonSign ¶
type ValueComparisonSign string
const ( LessThanComparisonSign ValueComparisonSign = "<" LessThanOrEqualsComparisonSign ValueComparisonSign = "<=" EqualsComparisonSign ValueComparisonSign = "=" GreaterThanOrEqualsComparisonSign ValueComparisonSign = ">=" GreaterThanComparisonSign ValueComparisonSign = ">" NotEqualsComparisonSign ValueComparisonSign = "!=" )
Click to show internal directories.
Click to hide internal directories.