Documentation
¶
Index ¶
- Variables
- func BuildFieldSql(field *Column) string
- func BuildIndexSql(index *Index) string
- func GetDb(dbConfig jcbaseGo.DbStruct) (db *gorm.DB, err error)
- func MakeInsertSql(tableName string, start int, size int) (data string, result []map[string]interface{})
- func TableCreateSql(opt TableCreateSqlOpt) (sql string)
- func TableFixSql(opt TableFixSqlOpt) (sqls []string)
- func TableSchemas(tableName string) (dump string)
- type AllTableName
- type CDDiffs
- type CDFields
- type CDIndexes
- type Column
- type CompareDiffs
- type Index
- type Schema
- type TableCreateSqlOpt
- type TableFixSqlOpt
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *gorm.DB
Functions ¶
func MakeInsertSql ¶
func MakeInsertSql(tableName string, start int, size int) (data string, result []map[string]interface{})
MakeInsertSql 获取某个表的insert语句
func TableCreateSql ¶
func TableCreateSql(opt TableCreateSqlOpt) (sql string)
TableCreateSql 根据数据表结构生成建表语句
Types ¶
type AllTableName ¶
type AllTableName struct {
TableName string `gorm:"table_name"`
}
type Column ¶
type Column struct {
Name string `json:"name"` // 字段名
Rename string `json:"rename"` // 修改前的字段名
Type string `json:"type"`
Length string `json:"length,omitempty"`
Default string `json:"default"`
Null bool `json:"null"`
Signed bool `json:"signed"`
Increment bool `json:"increment"`
Position string `json:"position"` // 指定新增到什么位置,如 AFTER `updated_at`;
}
type CompareDiffs ¶
type CompareDiffs struct {
Diffs *CDDiffs `json:"diffs"`
Fields *CDFields `json:"fields"`
Indexes *CDIndexes `json:"indexes"`
}
func SchemaCompare ¶
func SchemaCompare(table1 *Schema, table2 *Schema) *CompareDiffs
SchemaCompare 比较两张表的结构差异
type Schema ¶
type TableCreateSqlOpt ¶
Click to show internal directories.
Click to hide internal directories.