```
refactor(database): 重构数据库初始化逻辑 移除 NewDatabase 函数中的 Init 参数,改用 InitFunc 变量进行初始化操作。 更新 MigrateTables 附近的注释,明确说明 InitFunc 的用途。 删除函数内对 Init 参数的执行逻辑,确保代码简洁性。 ```
This commit is contained in:
18
with/init.go
Normal file
18
with/init.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package with
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/print"
|
||||
)
|
||||
|
||||
func InitData() {
|
||||
// Execute the Init function if it's not nil
|
||||
if database.InitFunc != nil {
|
||||
err := (*database.InitFunc)()
|
||||
if err != nil {
|
||||
print.Error(errcode.ErrEtcd.Error())
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user