feat(store): pgx pool and endpoints CRUD

This commit is contained in:
2026-07-01 16:50:45 +07:00
parent edda3dc21f
commit 420358b558
5 changed files with 149 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
package store
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
)
type Store struct {
Pool *pgxpool.Pool
}
func New(ctx context.Context, dsn string) (*Store, error) {
pool, err := pgxpool.New(ctx, dsn)
if err != nil {
return nil, err
}
if err := pool.Ping(ctx); err != nil {
return nil, err
}
return &Store{Pool: pool}, nil
}