-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (41 loc) · 1.08 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
_ "gf-generate/internal/logic"
"gf-generate/internal/cmd"
"gf-generate/internal/util"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcfg"
"github.com/gogf/gf/v2/os/gcmd"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gfile"
)
func main() {
ctx := gctx.GetInitCtx()
if path, _ := gfile.Search("hack"); path != "" {
if adapter, ok := g.Cfg().GetAdapter().(*gcfg.AdapterFile); ok {
if err := adapter.SetPath(path); err != nil {
g.Log().Fatal(ctx, err)
}
}
}
g.View().BindFuncMap(g.MapStrAny{
"CaseSnakeFirstUpper": util.CaseSnakeFirstUpper,
"CaseCamel": util.CaseCamel,
"CaseCamelLower": util.CaseCamelLower,
})
object, err := gcmd.NewFromObject(cmd.Gg)
if err != nil {
g.Log().Fatal(ctx, err.Error())
return
}
err = object.AddObject(cmd.Controller, cmd.Service, cmd.Ts)
if err != nil {
g.Log().Fatal(ctx, err.Error())
return
}
object.Run(ctx)
//buffer := bytes.NewBuffer(nil)
//buffer.WriteString("123")
//fmt.Println(buffer.ReadString('\n'))
//fmt.Println(buffer.ReadString('\n'))
}