Documentation
¶
Overview ¶
Package auditpostgres provides a supported-adapter Postgres audit recorder.
Use New with a ports.DatabasePool and Options when a service wants audit.Event writes stored in Postgres. Store implements audit.Recorder, validates table names before SQL construction, clones metadata through the audit contract, and can reuse a transaction from request context.
HealthChecker reports database readiness through the same pool. Keep raw secrets, request bodies, and high-cardinality identifiers out of audit metadata before calling Record.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidTable reports that a configured table name is not a safe SQL identifier. ErrInvalidTable = errors.New("invalid audit table") // ErrStoreNotConfigured reports that the store or pool was not configured. ErrStoreNotConfigured = errors.New("audit postgres store not configured") )
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
Pool ports.DatabasePool
// contains filtered or unexported fields
}
Store writes audit events to Postgres.
func New ¶
func New(pool ports.DatabasePool, opts Options) *Store
New creates a Postgres-backed audit recorder.
func (*Store) HealthChecker ¶
func (s *Store) HealthChecker() ports.HealthChecker
HealthChecker returns a Postgres audit dependency health checker.