Compare commits

..

1 Commits

Author SHA1 Message Date
7fa00f323f Refactor of pgsql client 2025-10-26 20:29:09 +01:00

View File

@@ -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