We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
demo项目中如果在启动时将service.Init()放置在model.Init()代码之前,则启动时不会报错,但是调用gorm时则会抛出异常
应用能否正确初始化不应该依赖于代码位置
在Repository工厂方法中加入gorm的空值判断用于提示开发者 func NewMysqlImpl(gh *gorm.DB) sys_user.Repository { if nil == gh { panic("model Init need before service Init") } return &mysqlImpl{ gh: gh, } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Your question
demo项目中如果在启动时将service.Init()放置在model.Init()代码之前,则启动时不会报错,但是调用gorm时则会抛出异常
Your scenes
应用能否正确初始化不应该依赖于代码位置
Your advice
在Repository工厂方法中加入gorm的空值判断用于提示开发者
func NewMysqlImpl(gh *gorm.DB) sys_user.Repository {
if nil == gh {
panic("model Init need before service Init")
}
return &mysqlImpl{
gh: gh,
}
}
The text was updated successfully, but these errors were encountered: