Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( UnsupportedCollate = func(c string) ShortDesc { return fmt.Sprintf("collate %s not supported", c) } UnsupportedColumnType = func(c string) ShortDesc { return fmt.Sprintf("%s %s", UnsupportedColumnTypeRaw, c) } )
Functions ¶
This section is empty.
Types ¶
type ColumnTypeMap ¶ added in v0.2.0
ColumnTypeMap: column name -> {source type: crdb type}.
func (ColumnTypeMap) String ¶ added in v0.2.0
func (ctm ColumnTypeMap) String() string
type ColumnTypeMapJson ¶ added in v0.2.0
type ColumnTypeMapJson struct {
ColumnName string `json:"column"`
SourceType string `json:"source_type"`
CRDBType string `json:"crdb_type"`
}
Json fields must be exported so that json can be unmarshalled.
type MySQLColumnMeta ¶
type MySQLColumnMeta struct {
ColumnDefault string
CharMaxLen int
CharOctetLen int
NumPrecision int32
NumScale int32
DatetimePrecision int32
CharSetName string
CollationName string
ColumnType string
ColumnKey string
Extra string
}
MySQLColumnMeta collects the information about the column in a MySQL table. This information are stored in the information_schema
func NewMySQLColumnMeta ¶
func NewMySQLColumnMeta() *MySQLColumnMeta
NewMySQLColumnMeta returns a new MySQLColumnMeta objects with unset/default value for all fields.
func (*MySQLColumnMeta) ToDefaultCRDBType ¶
func (cm *MySQLColumnMeta) ToDefaultCRDBType( dataType, colName string, ) (*types.T, []*TypeConvError)
This is based on managed-service/migration/internal/mysql/types.go.
type PGColumnMeta ¶ added in v0.2.0
type PGColumnMeta struct {
TypeOid oid.Oid
ColumnDefault string
CharMaxLen int
CharOctetLen int
NumPrecision int32
NumPrecRadix int32
NumScale int32
DatetimePrecision int32
IntervalType string
// TODO(janexing): handle collation
CollationName string
}
PGColumnMeta collects the information about the column in a PostgreSQL table. This information are stored in the information_schema
func NewPGColumnMeta ¶ added in v0.2.0
func NewPGColumnMeta() *PGColumnMeta
NewPGColumnMeta returns a new MyPGColumnMeta objects with unset/default value for all fields.
func (*PGColumnMeta) ToDefaultCRDBType ¶ added in v0.2.0
func (cm *PGColumnMeta) ToDefaultCRDBType(dataType, colName string) (*types.T, []*TypeConvError)
type ShortDesc ¶
type ShortDesc = string
const ( InvalidDecimalArgs ShortDesc = "Invalid decimal args" UnsupportedBytesMax ShortDesc = "Bytes limit not supported" UnsupportedColumnTypeRaw ShortDesc = "Unsupported column type" UnsupportedTinyInt ShortDesc = "TINYINT not supported" UnknownTypeForOID ShortDesc = "Unknown OID to convert to type" OIDNotFoundForTypeFromPG ShortDesc = "Failed finding OID for a type from PG source" UnknownIntervalType ShortDesc = "Unsupported interval type" )
type TableTypeMap ¶ added in v0.2.0
type TableTypeMap map[string]ColumnTypeMap
TableTypeMap: table name -> ColumnTypeMap
func GetOverrideTypeMapFromFile ¶ added in v0.2.0
func GetOverrideTypeMapFromFile(filepath string, logger zerolog.Logger) (TableTypeMap, error)
func (TableTypeMap) String ¶ added in v0.2.0
func (ttm TableTypeMap) String() string
type TableTypeMapJson ¶ added in v0.2.0
type TableTypeMapJson struct {
TableName string `json:"table"`
ColumnTypeMap []*ColumnTypeMapJson `json:"column_type_map"`
}
type TypeConvError ¶
type TypeConvError struct {
// ShortDescription is a key that can be used to uniquely identify a conversion
// failure type. It is friendly to display in frontends instead of the longer
// Message.
// We use this instead of an ENUM as the size can be quite large.
ShortDescription string
// Message denotes the message to display detailing the conversion failure.
Message string
// Blocking indicates whether the conversion failure blocks a statement
// from being marked as "complete".
Blocking bool
}
func (*TypeConvError) Error ¶
func (e *TypeConvError) Error() string
type TypeKV ¶ added in v0.2.0
type TypeKV struct {
// contains filtered or unexported fields
}
TypeKV: source type -> crdb type.