Using master pg library
This commit is contained in:
parent
d9a95a997c
commit
e0854aa001
8 changed files with 43 additions and 76 deletions
|
@ -1,7 +1,7 @@
|
|||
package database
|
||||
|
||||
import (
|
||||
"gopkg.in/pg.v4"
|
||||
"github.com/go-pg/pg"
|
||||
)
|
||||
|
||||
type DB interface {
|
||||
|
@ -45,7 +45,12 @@ type Options struct {
|
|||
|
||||
// Init the database connection
|
||||
func Init(options Options) (DB, error) {
|
||||
network := "tcp"
|
||||
if options.Addr[0] == '/' {
|
||||
network = "unix"
|
||||
}
|
||||
sql := pg.Connect(&pg.Options{
|
||||
Network: network,
|
||||
Addr: options.Addr,
|
||||
User: options.User,
|
||||
Password: options.Password,
|
||||
|
|
Reference in a new issue