package postgresql import ( "context" "fmt" "github.com/jackc/pgx/v5/pgxpool" ) type Database struct { db *pgxpool.Pool } func New(user, password, addr, dbname string) (*Database, error) { const op = "storage.postgresql.New" pool, err := pgxpool.New(context.Background(), fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=disable", user, password, addr, dbname)) if err != nil { return nil, fmt.Errorf("%s: %w", op, err) } return &Database{db: pool}, nil }