优化结构
This commit is contained in:
@@ -2,8 +2,8 @@ package initialize
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kra/internal/biz/system"
|
||||
|
||||
"kra/internal/biz"
|
||||
"kra/internal/conf"
|
||||
|
||||
"gorm.io/gorm"
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// initialization and runtime configuration management.
|
||||
type Backend interface {
|
||||
IsInitialized(context.Context) (bool, error)
|
||||
InitializeDatabase(context.Context, *biz.DatabaseConfig, func(context.Context, *gorm.DB) error) error
|
||||
InitializeDatabase(context.Context, *system.DatabaseConfig, func(context.Context, *gorm.DB) error) error
|
||||
PersistConfig(context.Context) error
|
||||
PersistAdminConfig(context.Context, []byte) error
|
||||
PersistRuntimeConfig(context.Context, []byte, []byte) error
|
||||
|
||||
@@ -2,8 +2,8 @@ package initialize
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kra/internal/biz/system"
|
||||
|
||||
"kra/internal/biz"
|
||||
datasystem "kra/internal/data/repository"
|
||||
platformmodule "kra/pkg/module"
|
||||
|
||||
@@ -15,7 +15,7 @@ type Repo struct {
|
||||
catalog platformmodule.Catalog
|
||||
}
|
||||
|
||||
func NewRepo(backend Backend, catalog platformmodule.Catalog) biz.InitializationRepo {
|
||||
func NewRepo(backend Backend, catalog platformmodule.Catalog) system.InitializationRepo {
|
||||
return &Repo{backend: backend, catalog: catalog}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ 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 {
|
||||
func (r *Repo) Initialize(ctx context.Context, input *system.DatabaseConfig) error {
|
||||
return r.backend.InitializeDatabase(ctx, input, func(ctx context.Context, db *gorm.DB) error {
|
||||
return datasystem.SeedSystemWithCatalog(ctx, db, input, r.catalog)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user