diff --git a/client/postgresql/postgres.go b/client/postgresql/postgres.go index 0ad7440..2838e7f 100644 --- a/client/postgresql/postgres.go +++ b/client/postgresql/postgres.go @@ -1,5 +1,7 @@ package postgresql +// Wrapper around jackx/pgx pool + import ( "context" "errors" @@ -9,7 +11,18 @@ import ( "github.com/jackc/pgx/v5/pgxpool" ) -func Connect(connStr string) (*pgxpool.Pool, error) { +type Database struct { + *pgxpool.Pool +} + +func NewDB(connStr string) *Database { + db := &Database{} + db.Connect(connStr) + + return db +} + +func (db *Database) Connect(connStr string) (*pgxpool.Pool, error) { pool, err := pgxpool.New(context.Background(), connStr) if err != nil { return nil, err