初始
This commit is contained in:
21
database/sqlite/sqlite.go
Normal file
21
database/sqlite/sqlite.go
Normal file
@ -0,0 +1,21 @@
|
||||
package sqlite
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/glebarez/sqlite"
|
||||
"github.com/tiger1103/gfast/v3/database"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func InitSqlite(path string) {
|
||||
fmt.Println(path)
|
||||
db, err := OpenDB(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
database.SetORMDBInstance(db)
|
||||
}
|
||||
|
||||
func OpenDB(path string) (*gorm.DB, error) {
|
||||
return gorm.Open(sqlite.Open(path), &gorm.Config{})
|
||||
}
|
Reference in New Issue
Block a user