Documentation ¶
Index ¶
- Constants
- Variables
- func AddImportContent(packageName string) io.Reader
- func Convert2PackageName(tableName string) string
- func ConvertUnderScoreToCamel(name string) string
- func GenSchemaStruct(w io.Writer, schemaArgs *SchemaArgs) (string, error)
- func GetDBInstance(conf *DBConfig) (*sql.DB, error)
- func OutputFile(rootPath, tableName string) (io.Writer, error)
- type Column
- type ColumnSlice
- type DBConfig
- type SchemaArgs
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" )
View Source
const DefaultSchemaOutputRootPath = "dao/mysql/schema"
Variables ¶
View Source
var (
TypeWrappers = []typeWrapper{i64TypeWrapper, byteTypeWrapper, intTypeWrapper, float64TypeWrapper, stringTypeWrapper, timeTypeWrapper}
)
Functions ¶
func AddImportContent ¶
func ConvertUnderScoreToCamel ¶
转换下划线字符串为驼峰格式,用于go 结构体命名
func GenSchemaStruct ¶
func GenSchemaStruct(w io.Writer, schemaArgs *SchemaArgs) (string, error)
schema转换struct的公用调用方法,用于schema命令的直接调用
Types ¶
type Column ¶
type Column struct { Name string `json:"COLUMN_NAME"` Type string `json:"COLUMN_TYPE"` Comment string `json:"COLUMN_COMMENT"` }
Column stands for a column of a table
type ColumnSlice ¶
type ColumnSlice []Column
func GetSchemaField ¶
func GetSchemaField(schemaArgs *SchemaArgs) (ColumnSlice, error)
从数据库表导出字段的方法,用于module命令的调用
Click to show internal directories.
Click to hide internal directories.