package db import ( "context" "sipro-mps/internal/config" "github.com/jackc/pgx/v5/pgxpool" _ "github.com/lib/pq" "go.uber.org/fx" ) func NewPgxPool(lc fx.Lifecycle, config config.Config) (*pgxpool.Pool, error) { ctx := context.Background() pool, err := pgxpool.New(ctx, config.Database.URL) if err != nil { return nil, err } lc.Append(fx.Hook{ OnStop: func(ctx context.Context) error { pool.Close() return nil }, }) return pool, nil }