22 lines
361 B
Go
22 lines
361 B
Go
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{})
|
|
}
|