Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditLogFilters ¶
type AuditLogFilters struct {
EventType models.EventType `json:"event_type,omitempty"`
ActorUserID string `json:"actor_user_id,omitempty"`
ResourceType models.ResourceType `json:"resource_type,omitempty"`
ResourceID string `json:"resource_id,omitempty"`
Severity models.EventSeverity `json:"severity,omitempty"`
Success *bool `json:"success,omitempty"`
StartTime time.Time `json:"start_time,omitzero"`
EndTime time.Time `json:"end_time,omitzero"`
ActorIP string `json:"actor_ip,omitempty"`
Search string `json:"search,omitempty"` // Search in action, resource_name, actor_username
}
AuditLogFilters contains filter criteria for querying audit logs
type AuditLogStats ¶
type AuditLogStats struct {
TotalEvents int64 `json:"total_events"`
EventsByType map[models.EventType]int64 `json:"events_by_type"`
EventsBySeverity map[models.EventSeverity]int64 `json:"events_by_severity"`
SuccessCount int64 `json:"success_count"`
FailureCount int64 `json:"failure_count"`
}
AuditLogStats contains statistics about audit logs
type PaginationParams ¶
type PaginationParams struct {
Page int // Current page number (1-indexed)
PageSize int // Number of items per page
Search string // Search keyword
StatusFilter string // Optional status filter (e.g. "pending", "active", "inactive")
}
PaginationParams contains parameters for paginated queries
func NewPaginationParams ¶
func NewPaginationParams(page, pageSize int, search string) PaginationParams
NewPaginationParams creates a new PaginationParams with default values
type PaginationResult ¶
type PaginationResult struct {
Total int64 // Total number of records
TotalPages int // Total number of pages
CurrentPage int // Current page number
PageSize int // Number of items per page
HasPrev bool // Whether there is a previous page
HasNext bool // Whether there is a next page
PrevPage int // Previous page number
NextPage int // Next page number
}
PaginationResult contains pagination metadata
func CalculatePagination ¶
func CalculatePagination(total int64, currentPage, pageSize int) PaginationResult
CalculatePagination calculates pagination metadata
func (PaginationResult) Offset ¶
func (p PaginationResult) Offset() int
Offset returns the zero-based row offset for use in LIMIT/OFFSET queries. It uses CurrentPage (already clamped to valid bounds) rather than the raw caller-supplied page number.
Click to show internal directories.
Click to hide internal directories.