Documentation
¶
Index ¶
- type AuditLogFilters
- type AuditRepository
- type GormRepository
- func (r *GormRepository) CreateAuditLog(ctx context.Context, log *models.AuditLog) (*models.AuditLog, error)
- func (r *GormRepository) GetAuditLogs(ctx context.Context, filters *AuditLogFilters) ([]models.AuditLog, int64, error)
- func (r *GormRepository) GetAuditLogsByTraceID(ctx context.Context, traceID string) ([]models.AuditLog, error)
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
Click to show internal directories.
Click to hide internal directories.