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