Documentation
¶
Index ¶
- func GetAuditLogDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetEventLogDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- type AuditLog
- type EventLog
- func (a *EventLog) CountByEventType(ctx context.Context, startTime, endTime time.Time) ([]schema.EventTypeCount, error)
- func (a *EventLog) CountTotal(ctx context.Context, startTime, endTime time.Time) (int64, error)
- func (a *EventLog) Create(ctx context.Context, item *schema.EventLog) error
- func (a *EventLog) CreateInBatches(ctx context.Context, items []*schema.EventLog) error
- func (a *EventLog) DeleteBefore(ctx context.Context, cutoff time.Time) (int64, error)
- func (a *EventLog) Query(ctx context.Context, params schema.EventQueryParam, ...) (*schema.EventQueryResult, error)
- func (a *EventLog) TopModels(ctx context.Context, startTime, endTime time.Time, limit int) ([]schema.RankingItem, error)
- func (a *EventLog) TopTenants(ctx context.Context, startTime, endTime time.Time, limit int) ([]schema.RankingItem, error)
- func (a *EventLog) TrendByDay(ctx context.Context, startTime, endTime time.Time) ([]schema.TrendPoint, error)
- func (a *EventLog) TrendByHour(ctx context.Context, startTime, endTime time.Time) ([]schema.TrendPoint, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAuditLogDB ¶
GetAuditLogDB returns the database instance for AuditLog.
Types ¶
type AuditLog ¶
AuditLog data access layer
func (*AuditLog) Query ¶
func (a *AuditLog) Query(ctx context.Context, params schema.AuditLogQueryParam, opts ...schema.AuditLogQueryOptions) (*schema.AuditLogQueryResult, error)
Query audit logs from the database.
type EventLog ¶
EventLog data access layer.
func (*EventLog) CountByEventType ¶
func (a *EventLog) CountByEventType(ctx context.Context, startTime, endTime time.Time) ([]schema.EventTypeCount, error)
CountByEventType counts events grouped by event_type within the given time range.
func (*EventLog) CountTotal ¶
CountTotal counts total events within the given time range.
func (*EventLog) CreateInBatches ¶
CreateInBatches inserts multiple event log records in batches.
func (*EventLog) DeleteBefore ¶
DeleteBefore deletes event logs older than the given cutoff time (physical delete).
func (*EventLog) Query ¶
func (a *EventLog) Query(ctx context.Context, params schema.EventQueryParam, opts ...schema.EventQueryOptions) (*schema.EventQueryResult, error)
Query event logs from the database based on the provided parameters and options.
func (*EventLog) TopModels ¶
func (a *EventLog) TopModels(ctx context.Context, startTime, endTime time.Time, limit int) ([]schema.RankingItem, error)
TopModels returns the top N models by event count.
func (*EventLog) TopTenants ¶
func (a *EventLog) TopTenants(ctx context.Context, startTime, endTime time.Time, limit int) ([]schema.RankingItem, error)
TopTenants returns the top N tenants by event count.
func (*EventLog) TrendByDay ¶
func (a *EventLog) TrendByDay(ctx context.Context, startTime, endTime time.Time) ([]schema.TrendPoint, error)
TrendByDay returns daily event counts for the given time range.
func (*EventLog) TrendByHour ¶
func (a *EventLog) TrendByHour(ctx context.Context, startTime, endTime time.Time) ([]schema.TrendPoint, error)
TrendByHour returns hourly event counts for the given time range.