Use pgx
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
package postgres
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"embed"
|
||||
"fmt"
|
||||
|
||||
"github.com/jackc/pgx/v4"
|
||||
_ "github.com/jackc/pgx/v4/stdlib"
|
||||
"github.com/pressly/goose/v3"
|
||||
)
|
||||
@ -25,5 +27,15 @@ func Connect(server string, user string, password string, database string) (*Que
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return New(conn), nil
|
||||
err = conn.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
connPG, err := pgx.Connect(context.Background(), connString)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return New(connPG), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user