mysql

package
v0.0.0-...-f0d4a1f Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBClient

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

DBClient 通用查询

func NewDBClient

func NewDBClient(dbUrl string) (*DBClient, error)

func (*DBClient) Query

func (entity *DBClient) Query(table string, result interface{}, where ...func(db *gorm.DB) *gorm.DB) error

type TableInfo

type TableInfo struct {
	TableSchema  string `gorm:"column:TABLE_SCHEMA"`
	TableName    string `gorm:"column:TABLE_NAME"`
	TableComment string `gorm:"column:TABLE_COMMENT"`
}

type TableInfoColumn

type TableInfoColumn struct {
	ColumnName    string `gorm:"column:COLUMN_NAME" json:"column_name"`
	DataType      string `gorm:"column:DATA_TYPE" json:"data_type"`
	ColumnKey     string `gorm:"column:COLUMN_KEY" json:"column_key"`
	IsNullable    string `gorm:"column:IS_NULLABLE" json:"is_nullable"`
	ColumnType    string `gorm:"column:COLUMN_TYPE" json:"column_type"`
	ColumnComment string `gorm:"column:COLUMN_COMMENT" json:"column_comment"`
}

type TableSchemaAnalyser

type TableSchemaAnalyser struct {
	DbUrl  string
	Client *DBClient
}

func NewTableSchemaAnalyser

func NewTableSchemaAnalyser(url string) (*TableSchemaAnalyser, error)

func (*TableSchemaAnalyser) QueryColumns

func (entity *TableSchemaAnalyser) QueryColumns(databaseName, table string) (rs []*TableInfoColumn, err error)

func (*TableSchemaAnalyser) QueryStatistics

func (entity *TableSchemaAnalyser) QueryStatistics(databaseName, table string) (rs []*TableStatistics, err error)

func (*TableSchemaAnalyser) QueryTable

func (entity *TableSchemaAnalyser) QueryTable(databaseName, table string) (tb *TableInfo, err error)

QueryTable 查询数据表基础信息

type TableStatistics

type TableStatistics struct {
	TableSchema  string `gorm:"column:TABLE_SCHEMA"`
	TableName    string `gorm:"column:TABLE_NAME"`
	NoUnique     bool   `gorm:"column:NON_UNIQUE"`
	IndexName    string `gorm:"column:INDEX_NAME"`
	SeqInIndex   int    `gorm:"column:SEQ_IN_INDEX"`
	ColumnName   string `gorm:"column:COLUMN_NAME"`
	IndexComment string `gorm:"column:INDEX_COMMENT"`
}

TableStatistics 数据表索引结构

Jump to

Keyboard shortcuts

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