database

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLogFilters

type AuditLogFilters struct {
	TraceID     *string
	EventType   *string
	EventAction *string
	Status      *string
	Limit       int
	Offset      int
}

AuditLogFilters represents query filters for retrieving audit logs

type AuditRepository

type AuditRepository interface {
	// CreateAuditLog creates a new audit log entry
	CreateAuditLog(ctx context.Context, log *models.AuditLog) (*models.AuditLog, error)

	// GetAuditLogsByTraceID retrieves all audit logs for a given trace ID
	GetAuditLogsByTraceID(ctx context.Context, traceID string) ([]models.AuditLog, error)

	// GetAuditLogs retrieves audit logs with optional filtering
	GetAuditLogs(ctx context.Context, filters *AuditLogFilters) ([]models.AuditLog, int64, error)
}

AuditRepository defines the database-agnostic interface for audit log operations This allows the service to work with any database implementation (PostgreSQL, MongoDB, etc.)

type GormRepository

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

GormRepository implements AuditRepository using GORM (works with SQLite or PostgreSQL)

func NewGormRepository

func NewGormRepository(db *gorm.DB) *GormRepository

NewGormRepository creates a new repository (works with SQLite or PostgreSQL)

func (*GormRepository) CreateAuditLog

func (r *GormRepository) CreateAuditLog(ctx context.Context, log *models.AuditLog) (*models.AuditLog, error)

CreateAuditLog creates a new audit log entry

func (*GormRepository) GetAuditLogs

func (r *GormRepository) GetAuditLogs(ctx context.Context, filters *AuditLogFilters) ([]models.AuditLog, int64, error)

GetAuditLogs retrieves audit logs with optional filtering

func (*GormRepository) GetAuditLogsByTraceID

func (r *GormRepository) GetAuditLogsByTraceID(ctx context.Context, traceID string) ([]models.AuditLog, error)

GetAuditLogsByTraceID retrieves all audit logs for a given trace ID

Jump to

Keyboard shortcuts

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