hotime/tools/sqlite/sqlite.go
2021-05-22 04:52:03 +08:00

18 lines
338 B
Go

package sqlite
import (
"../../../hotime"
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
func SetDB(appIns *hotime.Application) {
appIns.SetConnectDB(func(err ...*hotime.Error) *sql.DB {
db, e := sql.Open("sqlite3", appIns.Config.GetString("dbName"))
if e != nil && len(err) != 0 {
err[0].SetError(e)
}
return db
})
}