feat:goctl model mongo add easy flag for easy declare. (#2073)
* fix:typo in readme.md * feat:`goctl model mongo ` add `easy` flag to generate code with Auto generated CollectionName for easy declare. * fix:`goctl api doc ` when referenced api file contains no route,will generate an empty markdown file. * code: adjust code. Co-authored-by: 虫子樱桃 <czyt@w.cn>
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
type Context struct {
|
||||
Types []string
|
||||
Cache bool
|
||||
Easy bool
|
||||
Output string
|
||||
Cfg *config.Config
|
||||
}
|
||||
@@ -82,7 +83,9 @@ func generateCustomModel(ctx *Context) error {
|
||||
err = util.With("model").Parse(text).GoFmt(true).SaveTo(map[string]interface{}{
|
||||
"Type": stringx.From(t).Title(),
|
||||
"lowerType": stringx.From(t).Untitle(),
|
||||
"snakeType": stringx.From(t).ToSnake(),
|
||||
"Cache": ctx.Cache,
|
||||
"Easy": ctx.Easy,
|
||||
}, output, false)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -107,7 +110,7 @@ func generateTypes(ctx *Context) error {
|
||||
output := filepath.Join(ctx.Output, fn+".go")
|
||||
if err = util.With("model").Parse(text).GoFmt(true).SaveTo(map[string]interface{}{
|
||||
"Type": stringx.From(t).Title(),
|
||||
}, output, false);err!=nil{
|
||||
}, output, false); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user