Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnData ¶
ColumnData describes the columns of table
func (*ColumnData) Convert ¶
func (c *ColumnData) Convert() (*Table, error)
Convert converts column data into Table
type DbColumn ¶
type DbColumn struct {
Name string `db:"COLUMN_NAME"`
DataType string `db:"DATA_TYPE"`
ColumnType string `db:"COLUMN_TYPE"`
Extra string `db:"EXTRA"`
Comment string `db:"COLUMN_COMMENT"`
ColumnDefault any `db:"COLUMN_DEFAULT"`
IsNullAble string `db:"IS_NULLABLE"`
OrdinalPosition int `db:"ORDINAL_POSITION"`
}
DbColumn defines column info of columns
type DbIndex ¶
type DbIndex struct {
IndexName string `db:"INDEX_NAME"`
NonUnique int `db:"NON_UNIQUE"`
SeqInIndex int `db:"SEQ_IN_INDEX"`
}
DbIndex defines index of columns in information_schema.statistic
type InformationSchemaModel ¶
type InformationSchemaModel struct {
// contains filtered or unexported fields
}
InformationSchemaModel defines information schema model
func NewInformationSchemaModel ¶
func NewInformationSchemaModel(conn sqlx.SqlConn) *InformationSchemaModel
NewInformationSchemaModel creates an instance for InformationSchemaModel
func (*InformationSchemaModel) FindColumns ¶
func (m *InformationSchemaModel) FindColumns(db, table string) (*ColumnData, error)
FindColumns return columns in specified database and table
func (*InformationSchemaModel) FindIndex ¶
func (m *InformationSchemaModel) FindIndex(db, table, column string) ([]*DbIndex, error)
FindIndex finds index with given db, table and column.
func (*InformationSchemaModel) GetAllTables ¶
func (m *InformationSchemaModel) GetAllTables(database string) ([]string, error)
GetAllTables selects all tables from TABLE_SCHEMA
type PostgreColumn ¶
type PostgreColumn struct {
Num sql.NullInt32 `db:"num"`
Field sql.NullString `db:"field"`
Type sql.NullString `db:"type"`
NotNull sql.NullBool `db:"not_null"`
Comment sql.NullString `db:"comment"`
ColumnDefault sql.NullString `db:"column_default"`
IdentityIncrement sql.NullInt32 `db:"identity_increment"`
}
PostgreColumn describes a column in table
type PostgreIndex ¶
type PostgreIndex struct {
IndexName sql.NullString `db:"index_name"`
IndexId sql.NullInt32 `db:"index_id"`
IsUnique sql.NullBool `db:"is_unique"`
IsPrimary sql.NullBool `db:"is_primary"`
ColumnName sql.NullString `db:"column_name"`
IndexSort sql.NullInt32 `db:"index_sort"`
}
PostgreIndex describes an index for a column
type PostgreSqlModel ¶
type PostgreSqlModel struct {
// contains filtered or unexported fields
}
PostgreSqlModel gets table information from information_schema、pg_catalog
func NewPostgreSqlModel ¶
func NewPostgreSqlModel(conn sqlx.SqlConn) *PostgreSqlModel
NewPostgreSqlModel creates an instance and return
func (*PostgreSqlModel) FindColumns ¶
func (m *PostgreSqlModel) FindColumns(schema, table string) (*ColumnData, error)
FindColumns return columns in specified database and table
func (*PostgreSqlModel) FindIndex ¶
func (m *PostgreSqlModel) FindIndex(schema, table string) ([]*PostgreIndex, error)
FindIndex finds index with given schema, table and column.
func (*PostgreSqlModel) GetAllTables ¶
func (m *PostgreSqlModel) GetAllTables(schema string) ([]string, error)
GetAllTables selects all tables from TABLE_SCHEMA