Make the tests pass

This commit is contained in:
Las Zenow 2018-04-08 22:11:19 +00:00
parent 240a8a0430
commit f2b393a453
3 changed files with 17 additions and 23 deletions

View file

@ -66,6 +66,16 @@ type Options struct {
// Init the database connection
func Init(options Options) (DB, error) {
db, err := _init(options)
if err != nil {
return nil, err
}
go db.frontPageUpdater()
return db, nil
}
func _init(options Options) (*pgDB, error) {
network := "tcp"
if options.Addr[0] == '/' {
network = "unix"
@ -82,12 +92,7 @@ func Init(options Options) (DB, error) {
db.sql = sql
err := db.create()
if err != nil {
return nil, err
}
go db.frontPageUpdater()
return &db, nil
return &db, err
}
// Close the database connection