iedc-go/vendor/code.hoteas.com/golang/hotime/tools/sqlite/sqlite.go
2020-04-29 23:14:06 +08:00

18 lines
352 B
Go

package sqlite
import (
"code.hoteas.com/golang/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
})
}