structure: 确定基本结构(保持基本形式, 采用组合)

This commit is contained in:
loveuer
2024-11-01 17:47:33 +08:00
parent 9e8a47a7c6
commit 56cfd42bb9
52 changed files with 1003 additions and 176 deletions

View File

@ -4,10 +4,11 @@ import (
"github.com/spf13/cobra"
"uauth/internal/opt"
"uauth/internal/serve"
"uauth/internal/store/cache"
"uauth/internal/store/db"
"uauth/internal/tool"
"uauth/model"
"uauth/pkg/cache"
"uauth/pkg/rbac"
"uauth/pkg/store"
"uauth/tool"
)
func initServe() *cobra.Command {
@ -16,8 +17,9 @@ func initServe() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
tool.TablePrinter(opt.Cfg)
tool.Must(cache.Init(opt.Cfg.Svc.Cache))
tool.Must(db.Init(cmd.Context(), opt.Cfg.Svc.DB))
tool.Must(model.Init(db.Default.Session()))
tool.Must(store.Init(opt.Cfg.Svc.DB, store.Config{Debug: opt.Cfg.Debug}))
tool.Must(model.Init(store.Default.Session(tool.Timeout())))
tool.Must(rbac.Init(store.Default, cache.Client))
return serve.Run(cmd.Context())
},
}