iedc-go/tools/sqlite/sqlite.go

18 lines
352 B
Go
Raw Normal View History

2019-11-10 08:42:49 +00:00
package sqlite
import (
"code.hoteas.com/hoteas/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
})
}