api/app/db.go

22 lines
370 B
Go
Raw Normal View History

2018-05-14 14:19:29 +02:00
package app
import (
"database/sql"
"git.ultraware.nl/NiseVoid/qb/driver/autoqb"
"git.ultraware.nl/NiseVoid/qb/qbdb"
_ "github.com/lib/pq" // PostgreSQL driver
)
var db *qbdb.DB
// InitDB initializes the database connection
func InitDB() {
d, err := sql.Open(`postgres`, `host=/tmp dbname=power_quality`)
if err != nil {
panic(err)
}
db = autoqb.New(d)
}