Documentation ¶
Index ¶
Constants ¶
View Source
const ( CTypeInt64 = "int64" CTypeInt = "int" CTypeUInt = "uint" CTypeString = "string" CTypeFloat64 = "float64" CTypeTime = "time.Time" CTypeInt8 = "int8" CTypeUInt64 = "uint64" CTypeByte = "byte" CUnsigned = "unsigned" )
数据库类型与go数据类型之间的转换
View Source
const ( DTypeInt64 = "numeric" DTypeInt = "numeric" DTypeUInt = "numeric,gt=0" DTypeString = "alphanumunicode" DTypeFloat64 = "numeric" DTypeTime = "alphanumunicode" DTypeInt8 = "numeric" DTypeUInt64 = "numeric,gt=0" DTypeByte = "alphanumunicode" DUnsigned = "numeric,gt=0" )
数据库类型与validate类型之间的转换
View Source
const DTOCodeTemplate = `` /* 848-byte string literal not displayed */
View Source
const DomainGormDaoCodeTemplate = `` /* 4014-byte string literal not displayed */
完善Gorm Dao模板,根据goapp_account的实践
View Source
const DomainSqlBuilderDaoCodeTemplate = `` /* 3660-byte string literal not displayed */
View Source
const GormStructCodeTemplate = `` /* 1406-byte string literal not displayed */
完善Gorm Model模板,根据goapp_account的实践
View Source
const SchemaDbName = "information_schema"
View Source
const SqlBuilderStructCodeTemplate = `` /* 1300-byte string literal not displayed */
Variables ¶
View Source
var TypeWrappers = []typeWrapper{i64TypeWrapper, byteTypeWrapper, intTypeWrapper, float64TypeWrapper, stringTypeWrapper, timeTypeWrapper}
需要转换成Struct的类型转换函数切片
View Source
var TyperDTOWrappers = []typerDTOWrapper{i64TyperDTOWrapper, byteTyperDTOWrapper, intTyperDTOWrapper, float64TyperDTOWrapper, stringTyperDTOWrapper, timeTyperDTOWrapper}
需要转换成Struct的类型转换函数切片
Functions ¶
Types ¶
type CmdParams ¶
type CmdParams struct { Name string `json:"name"` Driver string `json:"driver"` Host string `json:"host"` Port int `json:"port"` DbName string `json:"database"` Table string `json:"table"` User string `json:"user"` Password string `json:"password"` OutputPath string `json:"output_path"` DOutputPath string `json:"dto_output_path"` Formatter string `json:"formatter"` }
命令参数
type Column ¶
type Column struct { Name string `json:"COLUMN_NAME"` Type string `json:"COLUMN_TYPE"` DTOTag string Comment string `json:"COLUMN_COMMENT"` }
Column stands for a column of a table
func GetTableSchema ¶
读取数据库schema表结构表,获取表结构的列信息
func (*Column) GetComment ¶
func (*Column) GetDTOType ¶
type FormatterDTO ¶
type FormatterDTO struct {
FormatterStruct
}
func NewFormatterDTOStruct ¶
func NewFormatterDTOStruct() *FormatterDTO
func (*FormatterDTO) Format ¶
func (f *FormatterDTO) Format(name, tableName string, cols []Column) IFormatter
type FormatterGorm ¶
type FormatterGorm struct {
FormatterStruct
}
func NewFormatterGorm ¶
func NewFormatterGorm() *FormatterGorm
func (*FormatterGorm) Format ¶
func (f *FormatterGorm) Format(name, table string, cols []Column) IFormatter
type FormatterGormDao ¶
type FormatterGormDao struct {
FormatterStruct
}
func NewFormatterGormDao ¶
func NewFormatterGormDao() *FormatterGormDao
func (*FormatterGormDao) Format ¶
func (f *FormatterGormDao) Format(name, table string, cols []Column) IFormatter
type FormatterSqlBuilder ¶
type FormatterSqlBuilder struct {
FormatterStruct
}
func NewFormatterSqlBuilder ¶
func NewFormatterSqlBuilder() *FormatterSqlBuilder
func (*FormatterSqlBuilder) Format ¶
func (f *FormatterSqlBuilder) Format(name, table string, cols []Column) IFormatter
type FormatterSqlBuilderDao ¶
type FormatterSqlBuilderDao struct {
FormatterStruct
}
func NewFormatterSqlBuilderDao ¶
func NewFormatterSqlBuilderDao() *FormatterSqlBuilderDao
func (*FormatterSqlBuilderDao) Format ¶
func (f *FormatterSqlBuilderDao) Format(name, table string, cols []Column) IFormatter
type FormatterStruct ¶
type FormatterStruct struct { PackageName string ImportList map[string]ImportItem StructName string TableName string FieldList []Field ModelFieldList []Field DTOFieldList []Field CreateDTOFieldList []Field UpdateDTOFieldList []Field }
格式化信息结构体
type IFormatter ¶
type ImportItem ¶
Click to show internal directories.
Click to hide internal directories.