infoschema

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	*DbColumn
	Index *DbIndex
}

Column defines column in 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   interface{} `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) (*Table, 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 Table

type Table struct {
	Db      string
	Table   string
	Columns []*Column
}

Table defines table data

Jump to

Keyboard shortcuts

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