hotime/tools/sqlite/sqlite.go

18 lines
338 B
Go
Raw Normal View History

2019-11-10 08:42:49 +00:00
package sqlite
import (
2021-05-21 20:52:03 +00:00
"../../../hotime"
2019-11-10 08:42:49 +00:00
"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
})
}