Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Column ¶
type Column struct { //Idx int `json:"idx"` Name string `json:"name"` Type ColumnType `json:"type"` RawType string `json:"raw_type"` DefaultVal ColumnValueString `json:"default_value_string"` IsNullable bool `json:"is_nullable"` IsUnsigned bool `json:"is_unsigned"` IsPrimaryKey bool `json:"is_primary_key"` IsGenerated bool `json:"is_generated"` }
Column
func (Column) EqualsDefault ¶
type ColumnType ¶ added in v0.9.59
type ColumnType = int
const ( TypeNumber ColumnType = iota + 1 // tinyint, smallint, int, bigint, year TypeMediumInt // medium int TypeFloat // float, double TypeEnum // enum TypeSet // set TypeString // other TypeDatetime // datetime TypeTimestamp // timestamp TypeDate // date TypeTime // time TypeBit // bit TypeJson // json TypeDecimal // decimal )
type ColumnValueString ¶
ColumnValueString is the same as sql.NullString We define it here in case we want to extend it.
func (*ColumnValueString) Equals ¶
func (v1 *ColumnValueString) Equals(v2 *ColumnValueString) bool
type SchemaStore ¶
type SchemaStore interface { GetSchema(database string) (Schema, error) InvalidateSchemaCache(schema string) InvalidateCache() IsInCache(dbName string) bool Close() }
func NewSimpleSchemaStoreFromDBConn ¶
func NewSimpleSchemaStoreFromDBConn(db *sql.DB) (SchemaStore, error)
type SimpleSchemaStore ¶
func NewSimpleSchemaStore ¶
func NewSimpleSchemaStore(dbCfg *config.DBConfig) (*SimpleSchemaStore, error)
func (*SimpleSchemaStore) Close ¶
func (store *SimpleSchemaStore) Close()
func (*SimpleSchemaStore) GetSchema ¶
func (store *SimpleSchemaStore) GetSchema(dbName string) (Schema, error)
func (*SimpleSchemaStore) InvalidateCache ¶
func (store *SimpleSchemaStore) InvalidateCache()
func (*SimpleSchemaStore) InvalidateSchemaCache ¶
func (store *SimpleSchemaStore) InvalidateSchemaCache(schema string)
func (*SimpleSchemaStore) IsInCache ¶
func (store *SimpleSchemaStore) IsInCache(dbName string) bool
type Table ¶
type Table struct { Version string `json:"version"` Schema string `json:"db_name"` Name string `json:"table_name"` Columns []Column `json:"columns"` PrimaryKeyColumns []Column `json:"primary_key_columns"` UniqueKeyColumnMap map[string][]string `json:"unique_key_columns"` // contains filtered or unexported fields }
Table
func GetTableDefFromDB ¶
func (*Table) ColumnNames ¶
func (*Table) MustColumn ¶
func (*Table) RenameColumn ¶
func (*Table) ReplaceSqlPrefix ¶ added in v0.9.59
Click to show internal directories.
Click to hide internal directories.