forked from golang/hotime
18 lines
352 B
Go
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
|
||
|
})
|
||
|
}
|