Documentation ¶
Index ¶
- Variables
- func ConvertToAvro(dbl *db.Loc, tableName string, inputType string, formatType string) ([]byte, error)
- func ConvertToAvroFromSchema(tblSchema *types.TableSchema, formatType string) ([]byte, error)
- func Get(dbl *db.Loc, table string, inputType string) (*types.TableSchema, error)
- func GetColumns(conn *sql.DB, dbName string, tableName string) (*types.TableSchema, error)
- func GetRaw(dbl *db.Loc, fullTable string, inputType string) (string, error)
- func HasPrimaryKey(s *types.TableSchema) bool
- func MutateTable(sdb *sql.DB, svc string, dbName string, tableName string, alter string, ...) bool
- func ParseColumnInfo(rows *sql.Rows, dbName, table string) (*types.TableSchema, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var MySQLToAvroType = map[string]types.AvroPrimitiveType{ "INT": types.AvroINT, "INTEGER": types.AvroINT, "TINYINT": types.AvroINT, "SMALLINT": types.AvroINT, "MEDIUMINT": types.AvroINT, "BOOLEAN": types.AvroBOOLEAN, "BIGINT": types.AvroLONG, "FLOAT": types.AvroFLOAT, "DOUBLE": types.AvroDOUBLE, "DECIMAL": types.AvroDOUBLE, "BIT": types.AvroBYTES, "CHAR": types.AvroSTRING, "VARCHAR": types.AvroSTRING, "BINARY": types.AvroBYTES, "VARBINARY": types.AvroBYTES, "TEXT": types.AvroSTRING, "TINYTEXT": types.AvroSTRING, "MEDIUMTEXT": types.AvroSTRING, "LONGTEXT": types.AvroSTRING, "JSON": types.AvroSTRING, "BLOB": types.AvroBYTES, "TINYBLOB": types.AvroBYTES, "MEDIUMBLOB": types.AvroBYTES, "LONGBLOB": types.AvroBYTES, "DATE": types.AvroSTRING, "DATETIME": types.AvroLONG, "TIMESTAMP": types.AvroLONG, "TIME": types.AvroSTRING, "YEAR": types.AvroINT, "ENUM": types.AvroSTRING, "SET": types.AvroSTRING, }
MySQLToAvroType is the static conversion map from MySQL types to Avro types
Functions ¶
func ConvertToAvro ¶
func ConvertToAvro(dbl *db.Loc, tableName string, inputType string, formatType string) ([]byte, error)
ConvertToAvro converts a MySQL schema to an Avro schema
func ConvertToAvroFromSchema ¶
func ConvertToAvroFromSchema(tblSchema *types.TableSchema, formatType string) ([]byte, error)
ConvertToAvroFromSchema converts a MySQL schema to an Avro schema
func GetColumns ¶
GetColumns reads structured schema from information_schema for table from given connection
func GetRaw ¶
GetRaw returns output of SHOW CREATE TABLE after the "CREATE TABLE xyz (" So called "raw" schema
func HasPrimaryKey ¶
func HasPrimaryKey(s *types.TableSchema) bool
HasPrimaryKey checks if given table has primary key
func MutateTable ¶
func MutateTable(sdb *sql.DB, svc string, dbName string, tableName string, alter string, ts *types.TableSchema, rawSchema *string) bool
MutateTable perform alter schema for the given table, using temporary table and return structured and raw schema
func ParseColumnInfo ¶
ParseColumnInfo reads parses column information into table schema
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.