You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
405 B

package dao
import (
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"texas-poker-bk/internal/conf"
)
var Dao *Persistent
type Persistent struct {
Sqlite *gorm.DB
}
func init() {
Dao = &Persistent{
Sqlite: newSqlite(),
}
}
func newSqlite() (db *gorm.DB) {
db, err := gorm.Open(sqlite.Open(conf.Conf.Sqlite.DbPath), &gorm.Config{
QueryFields: true,
})
if err != nil {
panic(err)
}
return db
}