schema

package
v0.0.0-...-9da90e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDbCond

func GetDbCond(dialect, dbname string) string

Types

type BaseSchema

type BaseSchema struct {
	TableCatalog string `db:"TABLE_CATALOG"`
	TableSchema  string `db:"TABLE_SCHEMA"`
	TableName    string `db:"TABLE_NAME"`
}

func (BaseSchema) DbName

func (s BaseSchema) DbName(engine string) string

func (BaseSchema) Engine

func (s BaseSchema) Engine() string

func (BaseSchema) String

func (s BaseSchema) String() string

type ColumnSchema

type ColumnSchema struct {
	ColumnName      string `db:"COLUMN_NAME"`
	ColumnType      string `db:"COLUMN_TYPE"`
	DataType        string `db:"DATA_TYPE"`
	ColumnDefault   string `db:"COLUMN_DEFAULT"`
	IsNullable      string `db:"IS_NULLABLE"`
	ColumnKey       string `db:"COLUMN_KEY"`
	Extra           string `db:"EXTRA"`
	OrdinalPosition int64  `db:"ORDINAL_POSITION"`
	BaseSchema
}

type DBSchema

type DBSchema struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func NewSchema

func NewSchema(db *gorm.DB) *DBSchema

func (*DBSchema) GetColumns

func (s *DBSchema) GetColumns(tableName string) (columns []ColumnSchema)

func (*DBSchema) GetDbName

func (s *DBSchema) GetDbName(onlyFunc bool) (dbname string)

func (*DBSchema) GetTables

func (s *DBSchema) GetTables(tableName, dbNameMatch string, isDesc bool) (tables []TableSchema)

func (*DBSchema) ListTable

func (s *DBSchema) ListTable(tableName, dbNameMatch string, refresh bool) (tables []TableSchema)

type TableSchema

type TableSchema struct {
	TableRows     int64 `db:"TABLE_ROWS"`
	AutoIncrement int64 `db:"AUTO_INCREMENT"`
	BaseSchema
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL