优化结构

This commit is contained in:
Yvan
2026-08-21 10:29:14 +08:00
parent 56980c8087
commit 055f6811ca
340 changed files with 382 additions and 382 deletions
+46
View File
@@ -0,0 +1,46 @@
package initialize
import (
"context"
"kra/internal/biz"
datasystem "kra/internal/data/repository"
platformmodule "kra/pkg/module"
"gorm.io/gorm"
)
type Repo struct {
backend Backend
catalog platformmodule.Catalog
}
func NewRepo(backend Backend, catalog platformmodule.Catalog) biz.InitializationRepo {
return &Repo{backend: backend, catalog: catalog}
}
func (r *Repo) IsInitialized(ctx context.Context) (bool, error) {
return r.backend.IsInitialized(ctx)
}
func (r *Repo) Initialize(ctx context.Context, input *biz.DatabaseConfig) error {
return r.backend.InitializeDatabase(ctx, input, func(ctx context.Context, db *gorm.DB) error {
return datasystem.SeedSystemWithCatalog(ctx, db, input, r.catalog)
})
}
func (r *Repo) PersistConfig(ctx context.Context) error {
return r.backend.PersistConfig(ctx)
}
func (r *Repo) PersistAdminConfig(ctx context.Context, value []byte) error {
return r.backend.PersistAdminConfig(ctx, value)
}
func (r *Repo) PersistRuntimeConfig(ctx context.Context, data, admin []byte) error {
return r.backend.PersistRuntimeConfig(ctx, data, admin)
}
func (r *Repo) ReloadConfig(ctx context.Context) error {
return r.backend.ReloadConfig(ctx)
}