MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / poolBeginFunc

Function poolBeginFunc

internal/webhookpub/worker.go:466–476  ·  view source on GitHub ↗

poolBeginFunc emulates pgx v4's BeginFunc against a *pgxpool.Pool (pgx v5 dropped the helper; we wrote our own).

(ctx context.Context, pool *pgxpool.Pool, fn func(tx pgx.Tx) error)

Source from the content-addressed store, hash-verified

464// poolBeginFunc emulates pgx v4's BeginFunc against a *pgxpool.Pool
465// (pgx v5 dropped the helper; we wrote our own).
466func poolBeginFunc(ctx context.Context, pool *pgxpool.Pool, fn func(tx pgx.Tx) error) error {
467 tx, err := pool.Begin(ctx)
468 if err != nil {
469 return err
470 }
471 defer tx.Rollback(ctx)
472 if err := fn(tx); err != nil {
473 return err
474 }
475 return tx.Commit(ctx)
476}
477
478// Compile guard to remind us we removed the BeginFunc method
479// reference above (kept the helper for clarity).

Callers 1

fanOutOneMethod · 0.85

Calls 2

RollbackMethod · 0.80
CommitMethod · 0.80

Tested by

no test coverage detected