ddl

package
v0.0.0-...-c008b1a Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetColumnInfo

func GetColumnInfo(tableName string) *list.List

*

  • 获取表的结构信息 *
  • select column_name, data_type, column_comment from information_schema.columns
  • where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position *
  • 增加 column_key 标识主键

Types

type ColumnInfo

type ColumnInfo struct {
	ColumnName    string
	JDBCType      string
	ColumnComment string
	ColumnKey     string // 可判断是不是主键 “PRI” 为主键
}

func (*ColumnInfo) DataType

func (c *ColumnInfo) DataType() string

func (*ColumnInfo) LowerCamelName

func (c *ColumnInfo) LowerCamelName() string

func (*ColumnInfo) StdJDBCType

func (c *ColumnInfo) StdJDBCType() string

func (*ColumnInfo) UpperCamelName

func (c *ColumnInfo) UpperCamelName() string

type TableInfo

type TableInfo struct {
	TableName    string // 原始表名
	BeanName     string // Java bean Name
	TableComment string
	Columns      []ColumnInfo
}

func GetTableInfo

func GetTableInfo(tableName string) *TableInfo

*

  • 获取表的信息 *
  • select table_name, table_comment, create_time, update_time
  • from information_schema.tables
  • where table_comment != ” and table_schema = (select database())
  • and table_name = 'u_user'

func (*TableInfo) Name

func (t *TableInfo) Name() string

Jump to

Keyboard shortcuts

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