main
kzkzzzz 2024-06-29 22:11:39 +08:00
parent ebf5c21cde
commit dd33153ca1
1 changed files with 4 additions and 5 deletions

View File

@ -53,17 +53,16 @@ func DB(key ...string) *gorm.DB {
return instance
}
func InitDefault(config *Config) error {
return Init(DefaultKey, config)
func InitDefault(config *Config) {
Init(DefaultKey, config)
}
func Init(key string, config *Config) error {
func Init(key string, config *Config) {
db, err := New(config)
if err != nil {
return err
panic(err)
}
instanceMap[key] = db
return nil
}
func New(config *Config) (*gorm.DB, error) {