Documentation
¶
Index ¶
- Constants
- Variables
- func AppendFile(filePath, content string)
- func CamelCaseToUdnderscore(s string) string
- func CopyTemplates(projName string, force bool)
- func CreateConfig(projName string) *viper.Viper
- func DownloadTemplates(force bool)
- func GenCode(projDir, moduleName, tableName string)
- func GenerateFile(projDir, typ string, data StructInfo) string
- func IsFolderName(name string) bool
- func ModGlobalConfig(projDir, comp string)
- func NewComponent(projDir, compName string)
- func NewModule(projDir, moduleName string)
- func NewProject(projName, comp string)
- func ParseTemplate(src, dest string, params any)
- func ReadFileByLine(filePath string) []string
- func RollbackGlobalConfig(projDir, comp string)
- func RollbackGomod(projDir, comp string)
- func Run()
- func UderscoreToLowerCamelCase(s string) string
- func UderscoreToUpperCamelCase(s string) string
- type ColumnInfo
- type ColumnInfoMysqlEntity
- type DBConfig
- type DBTool
- type MySQLTool
- type StructField
- type StructInfo
- type TableInfo
- type TableInfoMysqlEntity
- type VerInfo
- type WkCfg
Constants ¶
View Source
const PS = string(os.PathSeparator)
PS 路径分隔符
View Source
const TplRepo = "https://blob.workits.cn/templates/"
TplRepo 远程仓库地址
Variables ¶
View Source
var ErrExist = fmt.Errorf("exist") // 已存在
View Source
var ErrExit = fmt.Errorf("bye") // 退出
Functions ¶
func CamelCaseToUdnderscore ¶
CamelCaseToUdnderscore 驼峰单词转下划线单词
func GenerateFile ¶
func GenerateFile(projDir, typ string, data StructInfo) string
GenerateFile 生成文件
func NewProject ¶
func NewProject(projName, comp string)
func RollbackGlobalConfig ¶
func RollbackGlobalConfig(projDir, comp string)
RollbackGlobalConfig 回滚global.go
func UderscoreToLowerCamelCase ¶
UderscoreToLowerCamelCase 下划线单词转为小写驼峰单词
func UderscoreToUpperCamelCase ¶
UderscoreToUpperCamelCase 下划线单词转为大写驼峰单词
Types ¶
type ColumnInfo ¶
type ColumnInfo struct {
Field string
Type string
Null string
Key string
Default string
Comment string
}
ColumnInfo 字段信息
type ColumnInfoMysqlEntity ¶
type ColumnInfoMysqlEntity struct {
zorm.EntityStruct
Field string `column:"Field"`
Type string `column:"Type"`
Null string `column:"Null"`
Key string `column:"Key"`
Default string `column:"Default"`
Comment string `column:"Comment"`
}
ColumnInfoMysqlEntity 字段信息实体(MySQL)
type DBConfig ¶
type DBConfig struct {
Dialect string `mapstructure:"dialect"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
User string `mapstructure:"user"`
Pass string `mapstructure:"pass"`
Name string `mapstructure:"name"`
}
DBConfig 数据库配置
type MySQLTool ¶
type MySQLTool struct {
// contains filtered or unexported fields
}
func (*MySQLTool) GetTableInfo ¶
GetTableInfo 获取表信息
type StructField ¶
type StructField struct {
FieldName string
ColumnName string
JsonName string
Type string
Required bool
Comment string
IsPrimaryKey bool
Default any
}
StructField 结构体字段信息
type StructInfo ¶
type StructInfo struct {
GoModule string
ProjModule string
ModName string
Name string
StructName string
TableName string
FileName string
PrimaryKeyColumn string
PrimaryKeyField string
PrimaryKeyType string
PrimaryKeyName string
Fields []StructField
HasTime bool
HasDecimal bool
Comment string
IsStandard bool
}
StructInfo 结构体信息
func TypeConversion ¶
func TypeConversion(isStandard bool, tb *TableInfo) StructInfo
TypeConversion 类型转换
type TableInfo ¶
type TableInfo struct {
Name string
Comment string
Fields []ColumnInfo
}
TableInfo 表信息
type TableInfoMysqlEntity ¶
type TableInfoMysqlEntity struct {
zorm.EntityStruct
Name string `column:"Name"`
Comment string `column:"Comment"`
}
TableInfoMysqlEntity 表信息实体(MySQL)
Click to show internal directories.
Click to hide internal directories.