```
refactor(database): 移除全局初始化函数定义 将数据库初始化函数从 database 包中移除,避免全局状态污染。 feat(service): 新增 Use 方法用于执行初始化函数 在 Service 结构体中添加 Use 方法,允许传入并执行初始化函数。 如果函数执行失败,则打印错误并 panic。 refactor(with): 删除旧的初始化逻辑包 删除 with 包中与数据库初始化相关的旧逻辑,统一初始化入口。 ```
This commit is contained in:
@@ -15,8 +15,6 @@ import (
|
||||
var (
|
||||
// MigrateTables holds the tables that need to be auto-migrated on database initialization
|
||||
MigrateTables []any
|
||||
// Init is an optional initialization function that can be executed after database connection is established
|
||||
InitFunc *func() error = nil
|
||||
)
|
||||
|
||||
// NewDatabase creates a new database connection based on the provided driver type
|
||||
|
||||
Reference in New Issue
Block a user