Files
postgres/doc.go

21 lines
681 B
Go
Raw Normal View History

// Package postgres provides a pgx-backed PostgreSQL client with launcher and health integration.
//
// Usage:
//
// db := postgres.New(logger, cfg)
// lc.Append(db)
// r.Get("/health", health.NewHandler(logger, db))
//
// The component manages a pgxpool connection pool, implements launcher lifecycle hooks,
// and satisfies health.Checkable (priority: critical).
//
// Use [NewUnitOfWork] to wrap operations in a transaction:
//
// uow := postgres.NewUnitOfWork(logger, db)
// uow.Do(ctx, func(ctx context.Context) error {
// exec := db.GetExecutor(ctx) // returns the active transaction
// _, err := exec.Exec(ctx, "INSERT ...")
// return err
// })
package postgres