22 lines
370 B
Go
22 lines
370 B
Go
|
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)
|
||
|
}
|