types

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 DashboardCounts added in v0.24.0

type DashboardCounts struct {
	TotalUsers          int64 `gorm:"column:total_users"`
	AdminUsers          int64 `gorm:"column:admin_users"`
	DisabledUsers       int64 `gorm:"column:disabled_users"`
	TotalClients        int64 `gorm:"column:total_clients"`
	ActiveClients       int64 `gorm:"column:active_clients"`
	PendingClients      int64 `gorm:"column:pending_clients"`
	ActiveAccessTokens  int64 `gorm:"column:active_access_tokens"`
	ActiveRefreshTokens int64 `gorm:"column:active_refresh_tokens"`
}

DashboardCounts holds pre-aggregated counts for the admin dashboard, fetched in a single raw SQL query using scalar subselects.

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")
	CategoryFilter string // Optional category filter (e.g. "access", "refresh")
	ActiveOnly     bool   // When true, restrict results to active users (is_active = true)
}

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.

type UserStatsCounts added in v0.24.0

type UserStatsCounts struct {
	ActiveTokenCount         int64
	OAuthConnectionCount     int64
	ActiveAuthorizationCount int64
}

UserStatsCounts holds aggregate counts for a user's related records.

Jump to

Keyboard shortcuts

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