parser/db.go

26 lines
400 B
Go
Raw Normal View History

2018-05-07 14:07:37 +02:00
package main
import (
"database/sql"
"git.fuyu.moe/5GPowerQuality/parser/internal/migrations"
"git.ultraware.nl/NiseVoid/qb/driver/autoqb"
_ "github.com/lib/pq" // PostgreSQL driver
)
func initDB() {
d, err := sql.Open(`postgres`, `host=/tmp dbname=power_quality`)
if err != nil {
panic(err)
}
err = migrations.RunMigrations(d)
if err != nil {
panic(err)
}
db = autoqb.New(d)
}