This commit is contained in:
oneao committed 2026-04-01 21:51:18 +08:00
1 parent 4ef00e1d5d
commit 9e00adf2fe
27 files changed
+1104

No files matched your search

@@ -0,0 +1,38 @@
package bootstrap
import (
"allapp-go-v2/internal/config"
"allapp-go-v2/internal/pkg/logger"
"github.com/jackc/pgx/v5/pgxpool"
)
type App struct {
Config *config.Config
Db *pgxpool.Pool
}
func NewApp() (*App, error) {
cfg, err := config.Load()
if err != nil {
return nil, err
}
// 初始化日志
if err := logger.Init(cfg.App.Env); err != nil {
return nil, err
}
InitUniqueId(cfg)
db, err := InitDB(cfg)
if err != nil {
return nil, err
}
return &App{
Config: cfg,
Db: db,
}, nil
}