postgres

package
v0.13.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package postgres provides PostgreSQL storage for audit logs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RetentionDays int
}

Config configures the PostgreSQL audit store.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements audit.Logger using PostgreSQL.

func New

func New(db *sql.DB, cfg Config) *Store

New creates a new PostgreSQL audit store.

func (*Store) Cleanup

func (s *Store) Cleanup(ctx context.Context) error

Cleanup removes audit logs older than retention period.

func (*Store) Close

func (s *Store) Close() error

Close releases resources.

func (*Store) Log

func (s *Store) Log(ctx context.Context, event audit.Event) error

Log records an audit event.

func (*Store) Query

func (s *Store) Query(ctx context.Context, filter audit.QueryFilter) ([]audit.Event, error)

Query retrieves audit events matching the filter.

func (*Store) StartCleanupRoutine

func (s *Store) StartCleanupRoutine(ctx context.Context, interval time.Duration)

StartCleanupRoutine starts a background routine to clean up old audit logs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL