// Package repository реализует слой доступа к данным (PostgreSQL через pgxpool). // Предоставляет репозитории: UserRepo, RefreshTokenRepo, PlaceRepo, BookingRepo, // ReviewRepo, ServiceRepo, TagRepo, FeatureRepo. // Содержит функции для CRUD, фильтрации, работы с тегами/фичами мест и услуг. package repository import ( "context" "fmt" "github.com/jackc/pgx/v5/pgxpool" ) func NewPool(ctx context.Context, databaseURL string) (*pgxpool.Pool, error) { cfg, err := pgxpool.ParseConfig(databaseURL) if err != nil { return nil, fmt.Errorf("parse config: %w", err) } cfg.MaxConns = 20 cfg.MinConns = 2 pool, err := pgxpool.NewWithConfig(ctx, cfg) if err != nil { return nil, fmt.Errorf("create pool: %w", err) } if err := pool.Ping(ctx); err != nil { return nil, fmt.Errorf("ping db: %w", err) } return pool, nil }