dbi

package
v0.0.0-...-585920d Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTable

func ParseTable(table string) (schemaName, tableName string)

ParseTable parses the schema and table name from table which may be like db1.t1

func TrimNumber

func TrimNumber(s string) string

TrimNumber trim zeros from s.

Types

type MySQLSchema

type MySQLSchema struct {
	// contains filtered or unexported fields
}

MySQLSchema ...

func CreateMySQLSchema

func CreateMySQLSchema(dataSourceName string) (*MySQLSchema, error)

CreateMySQLSchema ...

func (*MySQLSchema) SetVerbose

func (s *MySQLSchema) SetVerbose(verbose bool)

SetVerbose sets verbose

func (*MySQLSchema) TableColumns

func (s *MySQLSchema) TableColumns(table string) ([]model.TableColumn, error)

TableColumns gets the all columns by table name

func (*MySQLSchema) Tables

func (s *MySQLSchema) Tables() ([]model.Table, error)

Tables get all the tables

type MySQLTable

type MySQLTable struct {
	Schema  string `gorm:"column:TABLE_SCHEMA"`
	Name    string `gorm:"column:TABLE_NAME"`
	Comment string `gorm:"column:TABLE_COMMENT"`
}

MySQLTable ...

func (MySQLTable) GetComment

func (m MySQLTable) GetComment() string

GetComment ...

func (MySQLTable) GetName

func (m MySQLTable) GetName() string

GetName ...

func (MySQLTable) GetScheme

func (m MySQLTable) GetScheme() string

GetScheme gets the table scheme

type MyTableColumn

type MyTableColumn struct {
	Name      string         `gorm:"column:COLUMN_NAME"`
	Type      string         `gorm:"column:COLUMN_TYPE"`
	Extra     string         `gorm:"column:EXTRA"` // auto_increment
	Comment   string         `gorm:"column:COLUMN_COMMENT"`
	DataType  string         `gorm:"column:DATA_TYPE"`
	MaxLength sql.NullInt64  `gorm:"column:CHARACTER_MAXIMUM_LENGTH"`
	Nullable  string         `gorm:"column:IS_NULLABLE"`
	Default   sql.NullString `gorm:"column:COLUMN_DEFAULT"`

	NumericPrecision sql.NullInt64 `gorm:"column:NUMERIC_PRECISION"`
	NumericScale     sql.NullInt64 `gorm:"column:NUMERIC_SCALE"`
}

MyTableColumn ...

func (MyTableColumn) GetComment

func (c MyTableColumn) GetComment() string

GetComment ...

func (MyTableColumn) GetDataType

func (c MyTableColumn) GetDataType() string

GetDataType ...

func (MyTableColumn) GetDefault

func (c MyTableColumn) GetDefault() string

GetDefault ...

func (MyTableColumn) GetMaxSize

func (c MyTableColumn) GetMaxSize() sql.NullInt64

GetMaxSize ...

func (MyTableColumn) GetName

func (c MyTableColumn) GetName() string

GetName ...

func (MyTableColumn) IsNullable

func (c MyTableColumn) IsNullable() bool

IsNullable ...

Jump to

Keyboard shortcuts

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