dal

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuditLogDB

func GetAuditLogDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetAuditLogDB returns the database instance for AuditLog.

func GetEventLogDB

func GetEventLogDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

GetEventLogDB returns the base DB query for event_log records.

Types

type AuditLog

type AuditLog struct {
	DB *gorm.DB
}

AuditLog data access layer

func (*AuditLog) Create

func (a *AuditLog) Create(ctx context.Context, item *schema.AuditLog) error

Create a new audit log entry.

func (*AuditLog) Get

func (a *AuditLog) Get(ctx context.Context, id string) (*schema.AuditLog, error)

Get the specified audit log from the database.

func (*AuditLog) Query

Query audit logs from the database.

type EventLog

type EventLog struct {
	DB *gorm.DB
}

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

func (a *EventLog) CountTotal(ctx context.Context, startTime, endTime time.Time) (int64, error)

CountTotal counts total events within the given time range.

func (*EventLog) Create

func (a *EventLog) Create(ctx context.Context, item *schema.EventLog) error

Create inserts a single event log record.

func (*EventLog) CreateInBatches

func (a *EventLog) CreateInBatches(ctx context.Context, items []*schema.EventLog) error

CreateInBatches inserts multiple event log records in batches.

func (*EventLog) DeleteBefore

func (a *EventLog) DeleteBefore(ctx context.Context, cutoff time.Time) (int64, error)

DeleteBefore deletes event logs older than the given cutoff time (physical delete).

func (*EventLog) Query

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.

Jump to

Keyboard shortcuts

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