Documentation ¶
Index ¶
- Constants
- Variables
- func IsTableExist(conn mysql.Executer, schema string, name string) (bool, error)
- type Index
- type Table
- func (ta *Table) AddColumn(name string, columnType string, collation string, extra string)
- func (ta *Table) AddIndex(name string) (index *Index)
- func (ta *Table) FindColumn(name string) int
- func (ta *Table) GetColumnValue(column string, row []interface{}) (interface{}, error)
- func (ta *Table) GetPKColumn(index int) *TableColumn
- func (ta *Table) GetPKValues(row []interface{}) ([]interface{}, error)
- func (ta *Table) String() string
- type TableColumn
Constants ¶
View Source
const ( TYPE_NUMBER = iota + 1 // tinyint, smallint, mediumint, int, bigint, year TYPE_FLOAT // float, double TYPE_ENUM // enum TYPE_SET // set TYPE_STRING // other TYPE_DATETIME // datetime TYPE_TIMESTAMP // timestamp TYPE_DATE // date TYPE_TIME // time TYPE_BIT // bit TYPE_JSON // json TYPE_DECIMAL // decimal )
Different column type
Variables ¶
View Source
var ErrMissingTableMeta = errors.New("missing table meta")
View Source
var ErrTableNotExist = errors.New("table is not exist")
View Source
var HAHealthCheckSchema = "mysql.ha_health_check"
Functions ¶
Types ¶
type Index ¶
func (*Index) FindColumn ¶
type Table ¶
type Table struct { Schema string Name string Columns []TableColumn Indexes []*Index PKColumns []int UnsignedColumns []int }
func NewTableFromSqlDB ¶
func (*Table) FindColumn ¶
func (*Table) GetColumnValue ¶
GetColumnValue gets term column's value
func (*Table) GetPKColumn ¶
func (ta *Table) GetPKColumn(index int) *TableColumn
func (*Table) GetPKValues ¶
GetPKValues gets primary keys in one row for a table, a table may use multi fields as the PK
Click to show internal directories.
Click to hide internal directories.