Documentation ¶
Index ¶
- Constants
- Variables
- func AppendFile(filePath, content string)
- func CamelCaseToUdnderscore(s string) string
- func CopyTemplates(projName string, force bool)
- func CreateConfig(projName string)
- func DownloadTemplates(force bool)
- func GenCode(projDir, moduleName, tableName, tableComment 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 ColumnInfoEntity
- type DBConfig
- type DBTool
- type MySQLTool
- type PostgreSQLTool
- type SQLiteTableInfoEntity
- type SQLiteTool
- type StructField
- type StructInfo
- type TableInfoEntity
- 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 ColumnInfoEntity ¶ added in v0.1.0
type ColumnInfoEntity struct { zorm.EntityStruct Field string `column:"Field"` Type string `column:"Type"` Null string `column:"Null"` Key string `column:"Key"` Len int `column:"len"` Default string `column:"Default"` Comment string `column:"Comment"` }
ColumnInfoEntity 字段信息实体
type DBConfig ¶
type DBConfig struct { Driver string `mapstructure:"driver"` 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 DBTool ¶
type DBTool interface {
TableToStructInfo(dbName, tableName string, isStandard bool) StructInfo
}
type MySQLTool ¶
type MySQLTool struct {
// contains filtered or unexported fields
}
func (*MySQLTool) TableToStructInfo ¶ added in v0.1.0
func (t *MySQLTool) TableToStructInfo(dbName, tableName string, isStandard bool) StructInfo
type PostgreSQLTool ¶ added in v0.1.0
type PostgreSQLTool struct {
// contains filtered or unexported fields
}
func (*PostgreSQLTool) TableToStructInfo ¶ added in v0.1.0
func (t *PostgreSQLTool) TableToStructInfo(dbName, tableName string, isStandard bool) StructInfo
type SQLiteTableInfoEntity ¶ added in v0.1.0
type SQLiteTool ¶ added in v0.1.0
type SQLiteTool struct {
// contains filtered or unexported fields
}
func (*SQLiteTool) TableToStructInfo ¶ added in v0.1.0
func (t *SQLiteTool) TableToStructInfo(dbName, tableName string, isStandard bool) StructInfo
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 结构体信息
type TableInfoEntity ¶ added in v0.1.0
type TableInfoEntity struct { zorm.EntityStruct Name string `column:"Name"` Comment string `column:"Comment"` Fields []*ColumnInfoEntity }
TableInfoEntity 表信息实体
Source Files ¶
Click to show internal directories.
Click to hide internal directories.