common

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: 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 {
	Name       string `json:"name" gorm:"column:COLUMN_NAME"`
	DataType   string `json:"dataType" gorm:"column:DATA_TYPE"`
	Extra      string `gorm:"column:EXTRA"`
	Comment    string `json:"comment" gorm:"column:COLUMN_COMMENT"`
	IsNullAble string `gorm:"column:IS_NULLABLE"`
}

type Field

type Field struct {
	Name     string
	DataType string
	Comment  string
}

结构体字段描述

type Index

type Index 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 Pattern

type Pattern map[string]struct{}

func ParseTableList

func ParseTableList(tableValue string) Pattern

func (Pattern) Match

func (p Pattern) Match(s string) bool

type SchemaModel

type SchemaModel interface {
	GetAllTables() ([]string, error)
	GetColumns(table string) (*Table, error)
	GetIndex(table, column string) ([]*Index, error)
}

Model gets table information from information_schema

type Table

type Table struct {
	Db      string
	Table   string
	Columns []Column
	// Primary key not included
	UniqueIndex map[string][]*Column
	PrimaryKey  *Column
	NormalIndex map[string][]*Column
}

Table describes mysql table which contains database name, table name, columns, keys

Jump to

Keyboard shortcuts

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