restructure
This commit is contained in:
21
providers/database/sqlite/sqlite.go
Normal file
21
providers/database/sqlite/sqlite.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package sqlite
|
||||
|
||||
import (
|
||||
"github.com/rogeecn/atom/container"
|
||||
"go.uber.org/dig"
|
||||
|
||||
// "gorm.io/driver/sqlite"
|
||||
"github.com/glebarez/sqlite"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func Provide(conf *Config, opts ...dig.ProvideOption) error {
|
||||
return container.Container.Provide(func() (*gorm.DB, error) {
|
||||
db, err := gorm.Open(sqlite.Open(conf.File), &gorm.Config{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return db, err
|
||||
}, opts...)
|
||||
}
|
||||
Reference in New Issue
Block a user