-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
48 lines (43 loc) · 1.27 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 (
"github.com/mizuki1412/go-core-kit/v2/cli"
"github.com/mizuki1412/go-core-kit/v2/cmd"
"github.com/mizuki1412/go-core-kit/v2/mod/common/admindivision"
"github.com/mizuki1412/go-core-kit/v2/mod/common/download"
"github.com/mizuki1412/go-core-kit/v2/mod/user"
"github.com/mizuki1412/go-core-kit/v2/mod/user/dao/userdao"
"github.com/mizuki1412/go-core-kit/v2/mod/user/model"
"github.com/mizuki1412/go-core-kit/v2/service/cachekit"
"github.com/mizuki1412/go-core-kit/v2/service/restkit"
"github.com/spf13/cobra"
)
func main() {
cli.RootCMD(&cobra.Command{
Use: "main",
Run: func(cmd *cobra.Command, args []string) {
restkit.AddActions(user.All()...)
restkit.AddActions(download.Init)
restkit.AddActions(admindivision.Init)
_ = restkit.Run()
},
})
c1 := &cobra.Command{
Use: "test",
Run: func(cmd *cobra.Command, args []string) {
},
}
c1.Flags().String("test", "", "")
c1.Flags().String("test1", "", "")
cli.AddChildCMD(c1)
cli.AddChildCMD(cmd.FrontDaoCMDNext("http://localhost:10000/v3/api-docs"))
cli.Execute()
}
func test() []*model.User {
return cachekit.Wrapper(cachekit.WrapParam{
Key: "abc",
Ttl: 0,
}, func() any {
dao := userdao.New(userdao.ResultDefault)
return dao.List(userdao.ListParam{})
}).([]*model.User)
}