Documentation
¶
Index ¶
- Constants
- Variables
- func AutoMigrate(db *gorm.DB) error
- func CertificateStatus(expiry time.Time) string
- func EncodeData(data interface{}) (datatypes.JSON, error)
- func IsValidGameStatus(status string) bool
- func IsValidStatus(status int) bool
- func MigrateAgentSessions(db *gorm.DB) error
- func NowUTC() time.Time
- type Admin
- type AdminGameEnvScope
- type AdminGameScope
- type AdminModel
- func (m *AdminModel) AssignRole(ctx context.Context, adminID, roleID uint) error
- func (m *AdminModel) Create(ctx context.Context, admin *Admin, password string) error
- func (m *AdminModel) Delete(ctx context.Context, id uint) error
- func (m *AdminModel) FindByUsername(ctx context.Context, username string) (*Admin, error)
- func (m *AdminModel) FindOne(ctx context.Context, id uint) (*Admin, error)
- func (m *AdminModel) GetAdminGames(ctx context.Context, adminID uint) ([]AdminGameScope, error)
- func (m *AdminModel) GetAdminRoles(ctx context.Context, adminID uint) ([]Role, error)
- func (m *AdminModel) List(ctx context.Context, opts ListAdminsOptions) ([]Admin, int64, error)
- func (m *AdminModel) RemoveGameEnvScope(ctx context.Context, adminID, gameID uint, env string) error
- func (m *AdminModel) RemoveGameScope(ctx context.Context, adminID, gameID uint) error
- func (m *AdminModel) RemoveRole(ctx context.Context, adminID, roleID uint) error
- func (m *AdminModel) SetGameEnvScope(ctx context.Context, adminID, gameID uint, env string) error
- func (m *AdminModel) SetGameScope(ctx context.Context, adminID, gameID uint) error
- func (m *AdminModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- func (m *AdminModel) UpdatePassword(ctx context.Context, id uint, newPassword string) error
- func (m *AdminModel) ValidatePassword(ctx context.Context, username, password string) (*Admin, error)
- type AdminRole
- type AgentSessionDB
- type AgentSessionModel
- type Alert
- type AlertModel
- func (m *AlertModel) BootstrapAlerts(ctx context.Context, alerts []Alert) error
- func (m *AlertModel) Create(ctx context.Context, alert *Alert) error
- func (m *AlertModel) CreateSilence(ctx context.Context, silence *AlertSilence) error
- func (m *AlertModel) DeleteSilence(ctx context.Context, silenceID uint) error
- func (m *AlertModel) FindByAlertID(ctx context.Context, alertID string) (*Alert, error)
- func (m *AlertModel) FindByIDs(ctx context.Context, ids []uint) (map[uint]*Alert, error)
- func (m *AlertModel) List(ctx context.Context, opts ListAlertsOptions) ([]Alert, int64, error)
- func (m *AlertModel) ListSilences(ctx context.Context, opts ListSilencesOptions) ([]AlertSilence, error)
- func (m *AlertModel) PruneExpiredSilences(ctx context.Context) error
- func (m *AlertModel) UpdateStatus(ctx context.Context, id uint, status string) error
- type AlertSilence
- type Backup
- type BackupModel
- func (m *BackupModel) Create(ctx context.Context, backup *Backup) error
- func (m *BackupModel) Delete(ctx context.Context, id uint) error
- func (m *BackupModel) DeleteByBackupID(ctx context.Context, backupID string) error
- func (m *BackupModel) FindByBackupID(ctx context.Context, backupID string) (*Backup, error)
- func (m *BackupModel) FindByID(ctx context.Context, id uint) (*Backup, error)
- func (m *BackupModel) List(ctx context.Context, opts ListBackupsOptions) ([]Backup, int64, error)
- type BehaviorDailyStat
- type BehaviorEvent
- type BehaviorEventOptions
- type BehaviorModel
- func (m *BehaviorModel) CountDistinctUsers(ctx context.Context, gameID, env string, start, end time.Time) (int64, error)
- func (m *BehaviorModel) CountEvents(ctx context.Context, gameID, env string, start, end time.Time) (int64, error)
- func (m *BehaviorModel) DailyActivity(ctx context.Context, gameID, env string, start, end time.Time) ([]BehaviorDailyStat, error)
- func (m *BehaviorModel) EventTypeCounts(ctx context.Context, gameID, env string, start, end time.Time, limit int) ([]EventTypeCount, error)
- func (m *BehaviorModel) ListEvents(ctx context.Context, opts BehaviorEventOptions) ([]BehaviorEvent, int64, error)
- func (m *BehaviorModel) ListFeatureAdoptions(ctx context.Context, gameID, env string) ([]FeatureAdoption, error)
- func (m *BehaviorModel) RecordEvent(ctx context.Context, event *BehaviorEvent) error
- func (m *BehaviorModel) UpsertFeatureAdoption(ctx context.Context, adoption *FeatureAdoption) error
- type Certificate
- type CertificateAlert
- type CertificateModel
- func (m *CertificateModel) AddAlert(ctx context.Context, alert *CertificateAlert) error
- func (m *CertificateModel) Create(ctx context.Context, cert *Certificate) error
- func (m *CertificateModel) Delete(ctx context.Context, id uint) error
- func (m *CertificateModel) ExpiringWithin(ctx context.Context, d time.Duration) ([]Certificate, error)
- func (m *CertificateModel) FindByDomain(ctx context.Context, domain string) (*Certificate, error)
- func (m *CertificateModel) FindOne(ctx context.Context, id uint) (*Certificate, error)
- func (m *CertificateModel) List(ctx context.Context, opts ListCertificatesOptions) ([]Certificate, int64, error)
- func (m *CertificateModel) ListAlerts(ctx context.Context, page, size int) ([]CertificateAlert, int64, error)
- func (m *CertificateModel) ListAll(ctx context.Context) ([]Certificate, error)
- func (m *CertificateModel) Stats(ctx context.Context) (map[string]int64, error)
- func (m *CertificateModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- type ConfigListOptions
- type ConfigVersion
- type ConfigVersionModel
- func (m *ConfigVersionModel) Create(ctx context.Context, key, value, createdBy string) (*ConfigVersion, error)
- func (m *ConfigVersionModel) CreateWithMeta(ctx context.Context, payload ConfigVersionPayload, createdBy string) (*ConfigVersion, error)
- func (m *ConfigVersionModel) Find(ctx context.Context, key string, version int) (*ConfigVersion, error)
- func (m *ConfigVersionModel) FindLatest(ctx context.Context, key string) (*ConfigVersion, error)
- func (m *ConfigVersionModel) List(ctx context.Context, key string) ([]ConfigVersion, error)
- func (m *ConfigVersionModel) ListLatest(ctx context.Context, opts ConfigListOptions) ([]ConfigVersion, error)
- type ConfigVersionPayload
- type DailyNewPlayerStat
- type DailyRevenueStat
- type Descriptor
- type Entity
- type EntityModel
- func (m *EntityModel) Create(ctx context.Context, entity *Entity) error
- func (m *EntityModel) Delete(ctx context.Context, id uint) error
- func (m *EntityModel) FindOne(ctx context.Context, id uint) (*Entity, error)
- func (m *EntityModel) List(ctx context.Context, opts ListEntitiesOptions) ([]Entity, int64, error)
- func (m *EntityModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- func (m *EntityModel) ValidateEntityData(entityType string, data interface{}) error
- type EventTypeCount
- type ExtensionCatalog
- type ExtensionEvent
- type ExtensionInstallation
- type ExtensionRelease
- type ExtensionRuntimeBinding
- type FAQ
- type FAQCategory
- type FAQCategoryStat
- type FAQModel
- func (m *FAQModel) Create(ctx context.Context, faq *FAQ) error
- func (m *FAQModel) Delete(ctx context.Context, id uint) error
- func (m *FAQModel) FindOne(ctx context.Context, id uint) (*FAQ, error)
- func (m *FAQModel) List(ctx context.Context, opts ListFAQOptions) ([]FAQ, int64, error)
- func (m *FAQModel) ListCategories(ctx context.Context) ([]FAQCategoryStat, error)
- func (m *FAQModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- func (m *FAQModel) UpsertCategory(ctx context.Context, category *FAQCategory) error
- type FeatureAdoption
- type Feedback
- type FeedbackModel
- func (m *FeedbackModel) Create(ctx context.Context, feedback *Feedback) error
- func (m *FeedbackModel) Delete(ctx context.Context, id uint) error
- func (m *FeedbackModel) FindByID(ctx context.Context, id uint) (*Feedback, error)
- func (m *FeedbackModel) List(ctx context.Context, opts ListFeedbackOptions) ([]Feedback, int64, error)
- func (m *FeedbackModel) Stats(ctx context.Context, opts FeedbackStatsOptions) (*FeedbackStatsResult, error)
- func (m *FeedbackModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- type FeedbackStatsOptions
- type FeedbackStatsResult
- type Function
- type FunctionDescriptor
- type FunctionInstance
- type FunctionModel
- func (m *FunctionModel) BatchCopyFunctions(ctx context.Context, functionIDs []string) (int, []string, []string, error)
- func (m *FunctionModel) BatchDeleteFunctions(ctx context.Context, functionIDs []string) (int, []string, error)
- func (m *FunctionModel) BatchUpdateStatus(ctx context.Context, functionIDs []string, enabled bool) (int, []string, error)
- func (m *FunctionModel) CopyFunction(ctx context.Context, functionID string) (string, error)
- func (m *FunctionModel) Create(ctx context.Context, fn *Function) error
- func (m *FunctionModel) Delete(ctx context.Context, id uint) error
- func (m *FunctionModel) DeleteFunction(ctx context.Context, functionID string) error
- func (m *FunctionModel) DeletePending(ctx context.Context, functionID string) error
- func (m *FunctionModel) FindByFunctionID(ctx context.Context, functionID string) (*Function, error)
- func (m *FunctionModel) FindByID(ctx context.Context, id uint) (*Function, error)
- func (m *FunctionModel) List(ctx context.Context, opts ListFunctionsOptions) ([]Function, int64, error)
- func (m *FunctionModel) ListDescriptorTemplates(ctx context.Context, category string) ([]Descriptor, error)
- func (m *FunctionModel) ListDescriptors(ctx context.Context, functionID string) ([]FunctionDescriptor, error)
- func (m *FunctionModel) ListFunctionMenus(ctx context.Context) (map[string]map[string]interface{}, error)
- func (m *FunctionModel) ListInstances(ctx context.Context, functionID string) ([]FunctionInstance, error)
- func (m *FunctionModel) ListPending(ctx context.Context) ([]PendingFunction, error)
- func (m *FunctionModel) ListPermissions(ctx context.Context, functionID string) ([]FunctionPermission, error)
- func (m *FunctionModel) RegisterInstance(ctx context.Context, instance *FunctionInstance) error
- func (m *FunctionModel) ReplacePermissions(ctx context.Context, functionID string, perms []FunctionPermission) error
- func (m *FunctionModel) SavePendingFunction(ctx context.Context, pending *PendingFunction) error
- func (m *FunctionModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- func (m *FunctionModel) UpsertDescriptor(ctx context.Context, desc *FunctionDescriptor) error
- type FunctionPermission
- type Game
- type GameEnv
- type GameModel
- func (m *GameModel) Create(ctx context.Context, game *Game) error
- func (m *GameModel) Delete(ctx context.Context, id uint) error
- func (m *GameModel) ExistsByNameIgnoreCase(ctx context.Context, name string, excludeID ...uint) (bool, error)
- func (m *GameModel) FindByGameID(ctx context.Context, gameID uint) (*Game, error)
- func (m *GameModel) FindByName(ctx context.Context, name string) (*Game, error)
- func (m *GameModel) FindOne(ctx context.Context, id uint) (*Game, error)
- func (m *GameModel) List(ctx context.Context, opts ListGamesOptions) ([]Game, int64, error)
- func (m *GameModel) ListAll(ctx context.Context) ([]Game, error)
- func (m *GameModel) ToggleEnabled(ctx context.Context, id uint) error
- func (m *GameModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- func (m *GameModel) UpdateStatus(ctx context.Context, id uint, status string) error
- type ListAdminsOptions
- type ListAlertsOptions
- type ListBackupsOptions
- type ListCertificatesOptions
- type ListEntitiesOptions
- type ListFAQOptions
- type ListFeedbackOptions
- type ListFunctionsOptions
- type ListGamesOptions
- type ListMessagesOptions
- type ListNodesOptions
- type ListPermissionsOptions
- type ListPlayersOptions
- type ListRolesOptions
- type ListSilencesOptions
- type ListTicketsOptions
- type Message
- type MessageModel
- func (m *MessageModel) CountUnread(ctx context.Context, to string) (int64, error)
- func (m *MessageModel) Create(ctx context.Context, msg *Message) error
- func (m *MessageModel) FindOne(ctx context.Context, id uint) (*Message, error)
- func (m *MessageModel) List(ctx context.Context, opts ListMessagesOptions) ([]Message, int64, error)
- func (m *MessageModel) MarkRead(ctx context.Context, id uint) error
- func (m *MessageModel) Recent(ctx context.Context, limit int, to string) ([]Message, error)
- type Node
- type NodeCommand
- type NodeModel
- func (m *NodeModel) FindByNodeID(ctx context.Context, nodeID string) (*Node, error)
- func (m *NodeModel) List(ctx context.Context, opts ListNodesOptions) ([]Node, error)
- func (m *NodeModel) ListCommands(ctx context.Context) ([]NodeCommand, error)
- func (m *NodeModel) UpdateMeta(ctx context.Context, nodeID string, updates map[string]interface{}) error
- func (m *NodeModel) UpdateStatus(ctx context.Context, nodeID, status string) error
- func (m *NodeModel) Upsert(ctx context.Context, node *Node) error
- func (m *NodeModel) UpsertCommand(ctx context.Context, command *NodeCommand) error
- type PaginationOptions
- type PaymentQueryOptions
- type PaymentTransaction
- type PaymentsModel
- func (m *PaymentsModel) AggregateRevenue(ctx context.Context, gameID, env string, start, end time.Time) (RevenueAggregate, error)
- func (m *PaymentsModel) CreateTransaction(ctx context.Context, tx *PaymentTransaction) error
- func (m *PaymentsModel) DailyRevenue(ctx context.Context, gameID, env string, start, end time.Time) ([]DailyRevenueStat, error)
- func (m *PaymentsModel) ListProductTrends(ctx context.Context, gameID, env string) ([]ProductTrend, error)
- func (m *PaymentsModel) ListTransactions(ctx context.Context, opts PaymentQueryOptions) ([]PaymentTransaction, int64, error)
- func (m *PaymentsModel) UpsertProductTrend(ctx context.Context, trend *ProductTrend) error
- type PendingFunction
- type Permission
- type PermissionModel
- type Player
- type PlayerModel
- func (m *PlayerModel) ActivatePlayer(ctx context.Context, id uint) error
- func (m *PlayerModel) BanPlayer(ctx context.Context, id uint) error
- func (m *PlayerModel) CountNewPlayers(ctx context.Context, gameID string, start, end time.Time) (int64, error)
- func (m *PlayerModel) Create(ctx context.Context, player *Player, password string) error
- func (m *PlayerModel) DailyNewPlayers(ctx context.Context, gameID string, start, end time.Time) ([]DailyNewPlayerStat, error)
- func (m *PlayerModel) Delete(ctx context.Context, id uint) error
- func (m *PlayerModel) FindByUsername(ctx context.Context, username string, gameID string) (*Player, error)
- func (m *PlayerModel) FindOne(ctx context.Context, id uint) (*Player, error)
- func (m *PlayerModel) List(ctx context.Context, opts ListPlayersOptions) ([]Player, int64, error)
- func (m *PlayerModel) SuspendPlayer(ctx context.Context, id uint) error
- func (m *PlayerModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- func (m *PlayerModel) UpdateBalance(ctx context.Context, id uint, amount int64, reason string) (*Player, error)
- func (m *PlayerModel) UpdatePassword(ctx context.Context, id uint, newPassword string) error
- func (m *PlayerModel) ValidatePassword(ctx context.Context, username, password, gameID string) (*Player, error)
- type ProductTrend
- type ProfileGame
- type ProfileModel
- func (m *ProfileModel) ListGames(ctx context.Context, adminID uint) ([]ProfileGame, error)
- func (m *ProfileModel) ListPermissions(ctx context.Context, adminID uint) ([]ProfilePermission, error)
- func (m *ProfileModel) ReplaceGames(ctx context.Context, adminID uint, games []ProfileGame) error
- func (m *ProfileModel) ReplacePermissions(ctx context.Context, adminID uint, perms []ProfilePermission) error
- type ProfilePermission
- type RateLimit
- type RateLimitModel
- func (m *RateLimitModel) Delete(ctx context.Context, id uint) error
- func (m *RateLimitModel) DeleteByKey(ctx context.Context, key string) error
- func (m *RateLimitModel) FindByID(ctx context.Context, id uint) (*RateLimit, error)
- func (m *RateLimitModel) FindByKey(ctx context.Context, key string) (*RateLimit, error)
- func (m *RateLimitModel) List(ctx context.Context, resource string) ([]RateLimit, error)
- func (m *RateLimitModel) Upsert(ctx context.Context, rl *RateLimit) error
- type RetentionCohort
- type RetentionModel
- type RevenueAggregate
- type Role
- type RoleModel
- func (m *RoleModel) Create(ctx context.Context, role *Role) error
- func (m *RoleModel) Delete(ctx context.Context, id uint) error
- func (m *RoleModel) FindOne(ctx context.Context, id uint) (*Role, error)
- func (m *RoleModel) GetRolePermissionIDs(ctx context.Context, roleID uint) ([]string, error)
- func (m *RoleModel) GetRolesPermissionIDs(ctx context.Context, roleIDs []uint) (map[uint][]string, error)
- func (m *RoleModel) List(ctx context.Context, opts ListRolesOptions) ([]Role, int64, error)
- func (m *RoleModel) ReplacePermissions(ctx context.Context, roleID uint, permissionIDs []string) error
- func (m *RoleModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- func (m *RoleModel) ValidatePermissionIDs(ctx context.Context, permissionIDs []string) ([]string, error)
- type RolePermission
- type SupportComment
- type SupportFAQ
- type SupportFeedback
- type SupportModel
- func (m *SupportModel) CreateComment(ctx context.Context, comment *SupportComment) error
- func (m *SupportModel) CreateFAQ(ctx context.Context, faq *SupportFAQ) error
- func (m *SupportModel) CreateFeedback(ctx context.Context, feedback *SupportFeedback) error
- func (m *SupportModel) CreateTicket(ctx context.Context, ticket *SupportTicket) error
- func (m *SupportModel) DeleteTicket(ctx context.Context, id uint) error
- func (m *SupportModel) ListComments(ctx context.Context, ticketID uint) ([]SupportComment, error)
- func (m *SupportModel) ListFAQs(ctx context.Context) ([]SupportFAQ, error)
- func (m *SupportModel) ListFeedback(ctx context.Context) ([]SupportFeedback, error)
- func (m *SupportModel) ListTickets(ctx context.Context, opts ListTicketsOptions) ([]SupportTicket, int64, error)
- func (m *SupportModel) UpdateTicket(ctx context.Context, id uint, updates map[string]interface{}) error
- type SupportTicket
- type TermDictionary
- type TermDictionaryModel
- func (m *TermDictionaryModel) AliasMap(ctx context.Context) (map[string]map[string]string, error)
- func (m *TermDictionaryModel) DeleteByAlias(ctx context.Context, domain, alias string) error
- func (m *TermDictionaryModel) List(ctx context.Context, domain string) ([]TermDictionary, error)
- func (m *TermDictionaryModel) Upsert(ctx context.Context, item *TermDictionary) error
- type Ticket
- type TicketComment
- type TicketModel
- func (m *TicketModel) Create(ctx context.Context, ticket *Ticket) error
- func (m *TicketModel) CreateComment(ctx context.Context, comment *TicketComment) error
- func (m *TicketModel) Delete(ctx context.Context, id uint) error
- func (m *TicketModel) FindOne(ctx context.Context, id uint) (*Ticket, error)
- func (m *TicketModel) List(ctx context.Context, opts TicketQueryOptions) ([]Ticket, int64, error)
- func (m *TicketModel) ListComments(ctx context.Context, ticketID uint) ([]TicketComment, error)
- func (m *TicketModel) Update(ctx context.Context, id uint, updates map[string]interface{}) error
- type TicketQueryOptions
- type TimestampMixin
- type WorkspaceConfig
- type WorkspaceConfigModel
- func (m *WorkspaceConfigModel) Delete(ctx context.Context, objectKey string) error
- func (m *WorkspaceConfigModel) FindByObjectKey(ctx context.Context, objectKey string) (*WorkspaceConfig, error)
- func (m *WorkspaceConfigModel) ListAll(ctx context.Context) ([]WorkspaceConfig, error)
- func (m *WorkspaceConfigModel) ListPublished(ctx context.Context) ([]WorkspaceConfig, error)
- func (m *WorkspaceConfigModel) SetPublished(ctx context.Context, objectKey string, published bool, publishedBy string) error
- func (m *WorkspaceConfigModel) Upsert(ctx context.Context, cfg *WorkspaceConfig) error
Constants ¶
const ( StatusDisabled = 0 StatusEnabled = 1 StatusSuspended = 2 )
状态常量
const ( GameStatusDev = "dev" GameStatusTest = "test" GameStatusRunning = "running" GameStatusOnline = "online" GameStatusOffline = "offline" GameStatusMaintenance = "maintenance" )
游戏状态常量
const ( PlayerStatusBanned = 0 PlayerStatusActive = 1 PlayerStatusSuspended = 2 )
玩家状态常量
Variables ¶
var ( ErrNotFound = gorm.ErrRecordNotFound ErrDuplicateKey = errors.New("duplicate key error") ErrInvalidData = errors.New("invalid data") ErrInvalidPassword = errors.New("invalid password") ErrPermissionDenied = errors.New("permission denied") ErrInsufficientBalance = errors.New("insufficient balance") )
常用错误定义
Functions ¶
func AutoMigrate ¶
AutoMigrate runs gorm auto migration for all server-owned tables.
func CertificateStatus ¶
CertificateStatus calculates status by expiry.
func EncodeData ¶
EncodeData converts arbitrary payload into datatypes.JSON.
func MigrateAgentSessions ¶
MigrateAgentSessions runs auto migration for agent sessions table.
Types ¶
type Admin ¶
type Admin struct {
gorm.Model
Username string `gorm:"uniqueIndex;size:64;not null"`
Nickname string `gorm:"size:128;index"`
Email string `gorm:"size:256;index"`
Phone string `gorm:"size:32;index"`
Avatar string `gorm:"size:512"`
PasswordHash string `gorm:"size:255"`
Status int `gorm:"default:1;index"` // 1:active 0:disabled
OTPSecret string `gorm:"size:64"`
LastLoginAt *time.Time `gorm:"index"`
CreatedBy uint `gorm:"index"`
UpdatedBy uint
}
Admin represents administrator accounts.
type AdminGameEnvScope ¶
type AdminGameEnvScope struct {
gorm.Model
AdminID uint `gorm:"index:idx_admin_game_env_scopes_admin_id;not null"`
GameID uint `gorm:"index:idx_admin_game_env_scopes_game_id;not null"`
Env string `gorm:"index:idx_admin_game_env_scopes_env;size:64;not null"`
}
AdminGameEnvScope limits admins to particular game environments.
func (AdminGameEnvScope) TableName ¶
func (AdminGameEnvScope) TableName() string
TableName implements gorm's tabler interface.
type AdminGameScope ¶
type AdminGameScope struct {
gorm.Model
AdminID uint `gorm:"index:idx_admin_game_scopes_admin_id;not null"`
GameID uint `gorm:"index:idx_admin_game_scopes_game_id;not null"`
}
AdminGameScope limits admins to particular games.
func (AdminGameScope) TableName ¶
func (AdminGameScope) TableName() string
TableName implements gorm's tabler interface.
type AdminModel ¶
type AdminModel struct {
// contains filtered or unexported fields
}
AdminModel exposes CRUD helpers backed by gorm.
func NewAdminModel ¶
func NewAdminModel(db *gorm.DB) *AdminModel
NewAdminModel creates a new AdminModel.
func (*AdminModel) AssignRole ¶
func (m *AdminModel) AssignRole(ctx context.Context, adminID, roleID uint) error
AssignRole attaches a role to an admin.
func (*AdminModel) Delete ¶
func (m *AdminModel) Delete(ctx context.Context, id uint) error
Delete deletes an admin by ID.
func (*AdminModel) FindByUsername ¶
FindByUsername fetches an admin by username.
func (*AdminModel) GetAdminGames ¶
func (m *AdminModel) GetAdminGames(ctx context.Context, adminID uint) ([]AdminGameScope, error)
GetAdminGames returns all games scoped to an admin.
func (*AdminModel) GetAdminRoles ¶
GetAdminRoles returns roles for an admin.
func (*AdminModel) List ¶
func (m *AdminModel) List(ctx context.Context, opts ListAdminsOptions) ([]Admin, int64, error)
List returns paginated admins plus total count.
func (*AdminModel) RemoveGameEnvScope ¶
func (m *AdminModel) RemoveGameEnvScope(ctx context.Context, adminID, gameID uint, env string) error
RemoveGameEnvScope removes a game env scope entry.
func (*AdminModel) RemoveGameScope ¶
func (m *AdminModel) RemoveGameScope(ctx context.Context, adminID, gameID uint) error
RemoveGameScope removes a game scope entry.
func (*AdminModel) RemoveRole ¶
func (m *AdminModel) RemoveRole(ctx context.Context, adminID, roleID uint) error
RemoveRole detaches a role from an admin.
func (*AdminModel) SetGameEnvScope ¶
SetGameEnvScope assigns a game env scope to an admin.
func (*AdminModel) SetGameScope ¶
func (m *AdminModel) SetGameScope(ctx context.Context, adminID, gameID uint) error
SetGameScope assigns a game scope to an admin.
func (*AdminModel) UpdatePassword ¶
UpdatePassword updates an admin password.
func (*AdminModel) ValidatePassword ¶
func (m *AdminModel) ValidatePassword(ctx context.Context, username, password string) (*Admin, error)
ValidatePassword validates credentials and updates last login timestamp.
type AdminRole ¶
type AdminRole struct {
gorm.Model
AdminID uint `gorm:"index:idx_admin_roles_admin_id;not null"`
RoleID uint `gorm:"index:idx_admin_roles_role_id;not null"`
}
AdminRole links admins and roles.
type AgentSessionDB ¶
type AgentSessionDB struct {
ID uint `gorm:"primaryKey"`
AgentID string `gorm:"size:64;uniqueIndex;not null"`
GameID string `gorm:"size:64;index"`
Env string `gorm:"size:32;index"`
RPCAddr string `gorm:"size:255;not null"`
Version string `gorm:"size:32"`
Region string `gorm:"size:64;index"`
Zone string `gorm:"size:64;index"`
Labels datatypes.JSON `gorm:"type:json"`
Providers datatypes.JSON `gorm:"type:json"`
ExpireAt time.Time `gorm:"index;not null"`
LastSeen time.Time `gorm:"index;not null"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
AgentSessionDB represents the database model for agent sessions.
func (AgentSessionDB) TableName ¶
func (AgentSessionDB) TableName() string
TableName specifies the table name for AgentSessionDB.
type AgentSessionModel ¶
type AgentSessionModel struct {
// contains filtered or unexported fields
}
AgentSessionModel manages agent session persistence.
func NewAgentSessionModel ¶
func NewAgentSessionModel(db *gorm.DB) *AgentSessionModel
NewAgentSessionModel creates a new AgentSessionModel.
func (*AgentSessionModel) DeleteExpired ¶
func (m *AgentSessionModel) DeleteExpired(ctx context.Context) (int64, error)
DeleteExpired soft-deletes all expired sessions.
func (*AgentSessionModel) LoadActiveSessions ¶
func (m *AgentSessionModel) LoadActiveSessions(ctx context.Context) ([]*registry.AgentSession, error)
LoadActiveSessions loads all active (non-expired, non-deleted) sessions.
func (*AgentSessionModel) Upsert ¶
func (m *AgentSessionModel) Upsert(ctx context.Context, sess *registry.AgentSession) error
Upsert inserts or updates an agent session.
type Alert ¶
type Alert struct {
gorm.Model
AlertID string `gorm:"size:64;uniqueIndex"`
Type string `gorm:"size:64"`
Level string `gorm:"size:32"`
Message string `gorm:"type:text"`
Source string `gorm:"size:64"`
Status string `gorm:"size:32;index"`
Details datatypes.JSONMap `gorm:"type:json"`
Metadata datatypes.JSONMap `gorm:"type:json"`
CreatedBy string `gorm:"size:64"`
}
Alert captures runtime system alerts for ops center.
type AlertModel ¶
type AlertModel struct {
// contains filtered or unexported fields
}
AlertModel provides CRUD operations for alerts and silences.
func NewAlertModel ¶
func NewAlertModel(db *gorm.DB) *AlertModel
NewAlertModel creates a new alert model helper.
func (*AlertModel) BootstrapAlerts ¶
func (m *AlertModel) BootstrapAlerts(ctx context.Context, alerts []Alert) error
BootstrapAlerts ensures seed data for testing/dev.
func (*AlertModel) Create ¶
func (m *AlertModel) Create(ctx context.Context, alert *Alert) error
Create inserts a new alert.
func (*AlertModel) CreateSilence ¶
func (m *AlertModel) CreateSilence(ctx context.Context, silence *AlertSilence) error
CreateSilence records a new silence window.
func (*AlertModel) DeleteSilence ¶
func (m *AlertModel) DeleteSilence(ctx context.Context, silenceID uint) error
DeleteSilence removes silence entry by ID.
func (*AlertModel) FindByAlertID ¶
FindByAlertID returns alert by external alert id.
func (*AlertModel) List ¶
func (m *AlertModel) List(ctx context.Context, opts ListAlertsOptions) ([]Alert, int64, error)
List returns paginated alerts.
func (*AlertModel) ListSilences ¶
func (m *AlertModel) ListSilences(ctx context.Context, opts ListSilencesOptions) ([]AlertSilence, error)
ListSilences returns alert silences.
func (*AlertModel) PruneExpiredSilences ¶
func (m *AlertModel) PruneExpiredSilences(ctx context.Context) error
PruneExpiredSilences removes expired silences.
func (*AlertModel) UpdateStatus ¶
UpdateStatus updates alert status.
type AlertSilence ¶
type AlertSilence struct {
gorm.Model
AlertID uint `gorm:"index"`
Reason string `gorm:"size:255"`
DurationMinute int `gorm:"default:0"`
ExpiresAt time.Time `gorm:"index"`
CreatedBy string `gorm:"size:64"`
}
AlertSilence stores silence windows for alerts.
func (AlertSilence) TableName ¶
func (AlertSilence) TableName() string
type Backup ¶
type Backup struct {
gorm.Model
BackupID string `gorm:"size:64;uniqueIndex"`
Name string `gorm:"size:128"`
Size int64
Type string `gorm:"size:32"`
Status string `gorm:"size:32"`
Location string `gorm:"size:255"`
Checksum string `gorm:"size:64"`
}
Backup stores backup metadata.
type BackupModel ¶
type BackupModel struct {
// contains filtered or unexported fields
}
BackupModel provides CRUD helpers for backups.
func NewBackupModel ¶
func NewBackupModel(db *gorm.DB) *BackupModel
NewBackupModel creates a new helper.
func (*BackupModel) Create ¶
func (m *BackupModel) Create(ctx context.Context, backup *Backup) error
Create inserts a new backup entry.
func (*BackupModel) Delete ¶
func (m *BackupModel) Delete(ctx context.Context, id uint) error
Delete removes a backup.
func (*BackupModel) DeleteByBackupID ¶
func (m *BackupModel) DeleteByBackupID(ctx context.Context, backupID string) error
DeleteByBackupID removes a backup using backup_id.
func (*BackupModel) FindByBackupID ¶
FindByBackupID fetches a backup via its stable backup_id.
func (*BackupModel) List ¶
func (m *BackupModel) List(ctx context.Context, opts ListBackupsOptions) ([]Backup, int64, error)
List returns paginated backups.
type BehaviorDailyStat ¶
BehaviorDailyStat describes per-day activity metrics.
type BehaviorEvent ¶
type BehaviorEvent struct {
gorm.Model
GameID string `gorm:"size:64;index"`
Env string `gorm:"size:32;index"`
EventType string `gorm:"size:64;index"`
UserID string `gorm:"size:64;index"`
Data datatypes.JSONMap `gorm:"type:json"`
OccurredAt time.Time `gorm:"index"`
}
BehaviorEvent stores raw behavior events for analytics.
type BehaviorEventOptions ¶
type BehaviorEventOptions struct {
PaginationOptions
GameID string
Env string
EventType string
StartTime time.Time
EndTime time.Time
}
BehaviorEventOptions controls event queries.
type BehaviorModel ¶
type BehaviorModel struct {
// contains filtered or unexported fields
}
BehaviorModel handles behavior analytics persistence.
func NewBehaviorModel ¶
func NewBehaviorModel(db *gorm.DB) *BehaviorModel
NewBehaviorModel creates a new behavior model helper.
func (*BehaviorModel) CountDistinctUsers ¶
func (m *BehaviorModel) CountDistinctUsers(ctx context.Context, gameID, env string, start, end time.Time) (int64, error)
CountDistinctUsers returns the number of unique users within the provided window.
func (*BehaviorModel) CountEvents ¶
func (m *BehaviorModel) CountEvents(ctx context.Context, gameID, env string, start, end time.Time) (int64, error)
CountEvents returns total events within the provided window.
func (*BehaviorModel) DailyActivity ¶
func (m *BehaviorModel) DailyActivity(ctx context.Context, gameID, env string, start, end time.Time) ([]BehaviorDailyStat, error)
DailyActivity returns per-day active users and event counts between the provided range.
func (*BehaviorModel) EventTypeCounts ¶
func (m *BehaviorModel) EventTypeCounts(ctx context.Context, gameID, env string, start, end time.Time, limit int) ([]EventTypeCount, error)
EventTypeCounts aggregates events by type, ordered by volume.
func (*BehaviorModel) ListEvents ¶
func (m *BehaviorModel) ListEvents(ctx context.Context, opts BehaviorEventOptions) ([]BehaviorEvent, int64, error)
ListEvents returns paginated behavior events.
func (*BehaviorModel) ListFeatureAdoptions ¶
func (m *BehaviorModel) ListFeatureAdoptions(ctx context.Context, gameID, env string) ([]FeatureAdoption, error)
ListFeatureAdoptions fetches adoption snapshots.
func (*BehaviorModel) RecordEvent ¶
func (m *BehaviorModel) RecordEvent(ctx context.Context, event *BehaviorEvent) error
RecordEvent stores a new behavior event.
func (*BehaviorModel) UpsertFeatureAdoption ¶
func (m *BehaviorModel) UpsertFeatureAdoption(ctx context.Context, adoption *FeatureAdoption) error
UpsertFeatureAdoption stores aggregated adoption data.
type Certificate ¶
type Certificate struct {
gorm.Model
Domain string `gorm:"size:255;uniqueIndex"`
CertificatePEM string `gorm:"type:text"`
PrivateKeyPEM string `gorm:"type:text"`
Issuer string `gorm:"size:255;index"`
ExpiresAt time.Time `gorm:"index"`
Status string `gorm:"size:32;index"` // active, expiring, expired
LastCheckedAt *time.Time `gorm:"index"`
ErrorMessage string `gorm:"type:text"`
}
Certificate stores TLS certificate metadata.
func (Certificate) TableName ¶
func (Certificate) TableName() string
type CertificateAlert ¶
type CertificateAlert struct {
gorm.Model
Domain string `gorm:"size:255;index"`
ThresholdDays int `gorm:"default:30"`
Active bool `gorm:"default:true;index"`
LastTriggeredAt *time.Time `gorm:"index"`
}
CertificateAlert stores alert thresholds for certificates.
func (CertificateAlert) TableName ¶
func (CertificateAlert) TableName() string
type CertificateModel ¶
type CertificateModel struct {
// contains filtered or unexported fields
}
CertificateModel manages certificate data.
func NewCertificateModel ¶
func NewCertificateModel(db *gorm.DB) *CertificateModel
NewCertificateModel returns helper.
func (*CertificateModel) AddAlert ¶
func (m *CertificateModel) AddAlert(ctx context.Context, alert *CertificateAlert) error
AddAlert creates alert.
func (*CertificateModel) Create ¶
func (m *CertificateModel) Create(ctx context.Context, cert *Certificate) error
Create stores certificate.
func (*CertificateModel) Delete ¶
func (m *CertificateModel) Delete(ctx context.Context, id uint) error
Delete removes certificate.
func (*CertificateModel) ExpiringWithin ¶
func (m *CertificateModel) ExpiringWithin(ctx context.Context, d time.Duration) ([]Certificate, error)
ExpiringWithin lists certificates expiring within duration.
func (*CertificateModel) FindByDomain ¶
func (m *CertificateModel) FindByDomain(ctx context.Context, domain string) (*Certificate, error)
FindByDomain fetches by domain.
func (*CertificateModel) FindOne ¶
func (m *CertificateModel) FindOne(ctx context.Context, id uint) (*Certificate, error)
FindOne fetches certificate by ID.
func (*CertificateModel) List ¶
func (m *CertificateModel) List(ctx context.Context, opts ListCertificatesOptions) ([]Certificate, int64, error)
List returns certificates with pagination.
func (*CertificateModel) ListAlerts ¶
func (m *CertificateModel) ListAlerts(ctx context.Context, page, size int) ([]CertificateAlert, int64, error)
ListAlerts returns alerts with pagination.
func (*CertificateModel) ListAll ¶
func (m *CertificateModel) ListAll(ctx context.Context) ([]Certificate, error)
ListAll returns all certificates.
type ConfigListOptions ¶
type ConfigVersion ¶
type ConfigVersion struct {
gorm.Model
Key string `gorm:"size:128;index:idx_config_key_version,priority:1"`
Version int `gorm:"index:idx_config_key_version,priority:2"`
Value string `gorm:"type:text"`
Format string `gorm:"size:16"`
GameID string `gorm:"size:64"`
Env string `gorm:"size:64"`
Message string `gorm:"size:255"`
CreatedBy string `gorm:"size:64"`
}
ConfigVersion stores versioned configuration values for arbitrary keys.
func (ConfigVersion) TableName ¶
func (ConfigVersion) TableName() string
type ConfigVersionModel ¶
type ConfigVersionModel struct {
// contains filtered or unexported fields
}
ConfigVersionModel provides helpers for managing configuration history.
func NewConfigVersionModel ¶
func NewConfigVersionModel(db *gorm.DB) *ConfigVersionModel
func (*ConfigVersionModel) Create ¶
func (m *ConfigVersionModel) Create(ctx context.Context, key, value, createdBy string) (*ConfigVersion, error)
Create inserts a new config version, automatically incrementing the version number.
func (*ConfigVersionModel) CreateWithMeta ¶
func (m *ConfigVersionModel) CreateWithMeta(ctx context.Context, payload ConfigVersionPayload, createdBy string) (*ConfigVersion, error)
CreateWithMeta inserts a new config version with metadata and optimistic locking support.
func (*ConfigVersionModel) Find ¶
func (m *ConfigVersionModel) Find(ctx context.Context, key string, version int) (*ConfigVersion, error)
Find returns the requested key/version pair.
func (*ConfigVersionModel) FindLatest ¶
func (m *ConfigVersionModel) FindLatest(ctx context.Context, key string) (*ConfigVersion, error)
FindLatest returns the newest version for the given key.
func (*ConfigVersionModel) List ¶
func (m *ConfigVersionModel) List(ctx context.Context, key string) ([]ConfigVersion, error)
List returns all versions for the given key ordered from newest to oldest.
func (*ConfigVersionModel) ListLatest ¶
func (m *ConfigVersionModel) ListLatest(ctx context.Context, opts ConfigListOptions) ([]ConfigVersion, error)
ListLatest fetches the latest version per key with optional filters.
type ConfigVersionPayload ¶
type DailyNewPlayerStat ¶
DailyNewPlayerStat captures per-day signup counts.
type DailyRevenueStat ¶
DailyRevenueStat tracks revenue per day.
type Descriptor ¶
type Descriptor struct {
gorm.Model
DescriptorID string `gorm:"size:64;uniqueIndex"`
Name string `gorm:"size:128"`
Description string `gorm:"type:text"`
Category string `gorm:"size:64"`
Schema datatypes.JSONMap `gorm:"type:json"`
}
Descriptor represents reusable descriptors independent of a function.
func (Descriptor) TableName ¶
func (Descriptor) TableName() string
type Entity ¶
type Entity struct {
gorm.Model
Type string `gorm:"size:64;index;not null"` // 实体类型: player, item, quest 等
Data datatypes.JSON `gorm:"type:json"` // JSON 数据
ProviderID string `gorm:"size:128;index"` // 提供者 ID
Status int `gorm:"default:1"` // 0:禁用 1:启用
}
Entity 实体结构体,用于动态内容管理
type EntityModel ¶
type EntityModel struct {
// contains filtered or unexported fields
}
EntityModel 提供实体数据访问方法
func (*EntityModel) Create ¶
func (m *EntityModel) Create(ctx context.Context, entity *Entity) error
Create 插入新实体
func (*EntityModel) Delete ¶
func (m *EntityModel) Delete(ctx context.Context, id uint) error
Delete 删除实体
func (*EntityModel) List ¶
func (m *EntityModel) List(ctx context.Context, opts ListEntitiesOptions) ([]Entity, int64, error)
List 分页获取实体列表
func (*EntityModel) ValidateEntityData ¶
func (m *EntityModel) ValidateEntityData(entityType string, data interface{}) error
ValidateEntityData 验证实体数据格式
type EventTypeCount ¶
EventTypeCount represents aggregated counts per event type.
type ExtensionCatalog ¶
type ExtensionCatalog struct {
gorm.Model
ExtensionID string `gorm:"size:128;uniqueIndex;not null" json:"extension_id"`
Name string `gorm:"size:128;not null" json:"name"`
DisplayName string `gorm:"size:255;not null" json:"display_name"`
Vendor string `gorm:"size:128;not null" json:"vendor"`
Kind string `gorm:"size:32;not null;index" json:"kind"`
Summary string `gorm:"type:text" json:"summary"`
IconURL string `gorm:"size:512" json:"icon_url"`
HomepageURL string `gorm:"size:512" json:"homepage_url"`
Status string `gorm:"size:32;not null;index" json:"status"`
LatestVersion string `gorm:"size:64" json:"latest_version"`
}
func (ExtensionCatalog) TableName ¶
func (ExtensionCatalog) TableName() string
type ExtensionEvent ¶
type ExtensionEvent struct {
gorm.Model
InstallationID uint `gorm:"not null;index" json:"installation_id"`
EventType string `gorm:"size:32;not null;index" json:"event_type"`
Level string `gorm:"size:16;not null;index" json:"level"`
Message string `gorm:"type:text;not null" json:"message"`
PayloadJSON datatypes.JSON `gorm:"type:json" json:"payload_json"`
CreatedBy string `gorm:"size:128" json:"created_by"`
}
func (ExtensionEvent) TableName ¶
func (ExtensionEvent) TableName() string
type ExtensionInstallation ¶
type ExtensionInstallation struct {
gorm.Model
InstallationKey string `gorm:"size:191;uniqueIndex;not null" json:"installation_key"`
ExtensionID string `gorm:"size:128;not null;index" json:"extension_id"`
ReleaseVersion string `gorm:"size:64;not null" json:"release_version"`
ScopeType string `gorm:"size:32;not null;index" json:"scope_type"`
ScopeID string `gorm:"size:128;not null;index" json:"scope_id"`
TargetType string `gorm:"size:32;not null;index" json:"target_type"`
TargetID string `gorm:"size:128;index" json:"target_id"`
Status string `gorm:"size:32;not null;index" json:"status"`
DesiredState string `gorm:"size:32;not null;index" json:"desired_state"`
Enabled bool `gorm:"not null;default:false;index" json:"enabled"`
ConfigJSON datatypes.JSON `gorm:"type:json" json:"config_json"`
SecretRefsJSON datatypes.JSON `gorm:"type:json" json:"secret_refs_json"`
LastError string `gorm:"type:text" json:"last_error"`
InstalledBy string `gorm:"size:128" json:"installed_by"`
InstalledAtUnix int64 `gorm:"not null;default:0;index" json:"installed_at_unix"`
}
func (ExtensionInstallation) TableName ¶
func (ExtensionInstallation) TableName() string
type ExtensionRelease ¶
type ExtensionRelease struct {
gorm.Model
ExtensionID string `gorm:"size:128;not null;index:idx_extension_release_version,priority:1" json:"extension_id"`
Version string `gorm:"size:64;not null;index:idx_extension_release_version,priority:2" json:"version"`
ReleaseChannel string `gorm:"size:32;not null;index" json:"release_channel"`
ManifestJSON datatypes.JSON `gorm:"type:json;not null" json:"manifest_json"`
PackageRef string `gorm:"size:512" json:"package_ref"`
Checksum string `gorm:"size:128" json:"checksum"`
MinCoreVersion string `gorm:"size:64" json:"min_core_version"`
Changelog string `gorm:"type:text" json:"changelog"`
PublishedAtUnix int64 `gorm:"not null;default:0;index" json:"published_at_unix"`
}
func (ExtensionRelease) TableName ¶
func (ExtensionRelease) TableName() string
type ExtensionRuntimeBinding ¶
type ExtensionRuntimeBinding struct {
gorm.Model
InstallationID uint `gorm:"not null;index;uniqueIndex:uk_extension_runtime_binding_installation_key,priority:1" json:"installation_id"`
BindingType string `gorm:"size:32;not null;index" json:"binding_type"`
BindingKey string `gorm:"size:191;not null;uniqueIndex:uk_extension_runtime_binding_installation_key,priority:2" json:"binding_key"`
TargetRef string `gorm:"size:255" json:"target_ref"`
SpecJSON datatypes.JSON `gorm:"type:json" json:"spec_json"`
Status string `gorm:"size:32;not null;index" json:"status"`
LastError string `gorm:"type:text" json:"last_error"`
}
func (ExtensionRuntimeBinding) TableName ¶
func (ExtensionRuntimeBinding) TableName() string
type FAQ ¶
type FAQ struct {
gorm.Model
Question string `gorm:"type:text"`
Answer string `gorm:"type:text"`
Category string `gorm:"size:64;index"`
Tags datatypes.JSON `gorm:"type:json"`
Visible bool `gorm:"default:true"`
Sort int `gorm:"default:0"`
Views int `gorm:"default:0"`
}
FAQ represents a knowledge base entry.
type FAQCategory ¶
type FAQCategory struct {
gorm.Model
Name string `gorm:"size:64;uniqueIndex"`
Description string `gorm:"size:255"`
Visible bool `gorm:"default:true"`
Sort int `gorm:"default:0"`
}
FAQCategory stores FAQ category metadata.
func (FAQCategory) TableName ¶
func (FAQCategory) TableName() string
type FAQCategoryStat ¶
ListCategories fetches FAQ categories.
type FAQModel ¶
type FAQModel struct {
// contains filtered or unexported fields
}
FAQModel manages FAQ data.
func (*FAQModel) ListCategories ¶
func (m *FAQModel) ListCategories(ctx context.Context) ([]FAQCategoryStat, error)
func (*FAQModel) UpsertCategory ¶
func (m *FAQModel) UpsertCategory(ctx context.Context, category *FAQCategory) error
UpsertCategory stores category metadata.
type FeatureAdoption ¶
type FeatureAdoption struct {
gorm.Model
GameID string `gorm:"size:64;index"`
Env string `gorm:"size:32;index"`
Feature string `gorm:"size:64;index:idx_feature_unique,unique"`
Users int `gorm:"default:0"`
AdoptionRate float64 `gorm:"default:0"`
Frequency float64 `gorm:"default:0"`
WindowStart time.Time
WindowEnd time.Time
}
FeatureAdoption stores feature adoption metrics snapshots.
func (FeatureAdoption) TableName ¶
func (FeatureAdoption) TableName() string
type Feedback ¶
type Feedback struct {
gorm.Model
PlayerID string `gorm:"size:64;index"`
Contact string `gorm:"size:128"`
Content string `gorm:"type:text"`
Category string `gorm:"size:64;index"`
Priority string `gorm:"size:16;index"`
Status string `gorm:"size:16;index"`
Rating int `gorm:"default:0;index"`
Reply string `gorm:"type:text"`
Attach string `gorm:"type:text"`
GameID string `gorm:"size:64;index:idx_feedback_game_env,priority:1"`
Env string `gorm:"size:64;index:idx_feedback_game_env,priority:2"`
}
Feedback represents player feedback submission.
type FeedbackModel ¶
type FeedbackModel struct {
// contains filtered or unexported fields
}
FeedbackModel manages feedback entries.
func NewFeedbackModel ¶
func NewFeedbackModel(db *gorm.DB) *FeedbackModel
NewFeedbackModel creates helper.
func (*FeedbackModel) Create ¶
func (m *FeedbackModel) Create(ctx context.Context, feedback *Feedback) error
Create inserts feedback entry.
func (*FeedbackModel) Delete ¶
func (m *FeedbackModel) Delete(ctx context.Context, id uint) error
Delete removes feedback entry.
func (*FeedbackModel) List ¶
func (m *FeedbackModel) List(ctx context.Context, opts ListFeedbackOptions) ([]Feedback, int64, error)
List fetches paginated feedback entries.
func (*FeedbackModel) Stats ¶
func (m *FeedbackModel) Stats(ctx context.Context, opts FeedbackStatsOptions) (*FeedbackStatsResult, error)
Stats returns aggregate metrics for feedback entries.
type FeedbackStatsOptions ¶
FeedbackStatsOptions configures stats calculations.
type FeedbackStatsResult ¶
type FeedbackStatsResult struct {
Total int64
ByCategory map[string]int64
ByStatus map[string]int64
AvgRating float64
Responded int64
}
FeedbackStatsResult aggregates statistics for feedback.
type Function ¶
type Function struct {
gorm.Model
FunctionID string `gorm:"size:64;uniqueIndex"`
Name string `gorm:"size:128"`
Description string `gorm:"type:text"`
Category string `gorm:"size:64;index"`
GameID string `gorm:"size:64;index"`
Status int `gorm:"index"`
Version string `gorm:"size:32"`
Instances int `gorm:"default:0"`
Runtime string `gorm:"size:64"`
Entry string `gorm:"size:128"`
Schema datatypes.JSONMap `gorm:"type:json"` // Legacy descriptor format (deprecated)
Metadata datatypes.JSONMap `gorm:"type:json"` // Additional metadata
SpecFormat string `gorm:"size:32;index"` // Format: "legacy", "openapi3.0.3"
OpenAPISpec datatypes.JSONMap `gorm:"type:json"` // OpenAPI 3.0.3 Operation object
}
Function represents a registered callable unit.
type FunctionDescriptor ¶
type FunctionDescriptor struct {
gorm.Model
FunctionID string `gorm:"size:64;index"`
Version string `gorm:"size:32"`
Input datatypes.JSONMap `gorm:"type:json"`
Output datatypes.JSONMap `gorm:"type:json"`
Schema datatypes.JSONMap `gorm:"type:json"`
}
FunctionDescriptor stores detailed descriptor versions.
func (FunctionDescriptor) TableName ¶
func (FunctionDescriptor) TableName() string
type FunctionInstance ¶
type FunctionInstance struct {
gorm.Model
FunctionID string `gorm:"size:64;index"`
AgentID string `gorm:"size:64;index"`
AgentName string `gorm:"size:128"`
Status string `gorm:"size:32"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
Metadata datatypes.JSONMap `gorm:"type:json"`
}
FunctionInstance tracks runtime deployments.
func (FunctionInstance) TableName ¶
func (FunctionInstance) TableName() string
type FunctionModel ¶
type FunctionModel struct {
// contains filtered or unexported fields
}
FunctionModel wraps data access for functions and related tables.
func NewFunctionModel ¶
func NewFunctionModel(db *gorm.DB) *FunctionModel
NewFunctionModel creates the helper.
func (*FunctionModel) BatchCopyFunctions ¶
func (m *FunctionModel) BatchCopyFunctions(ctx context.Context, functionIDs []string) (int, []string, []string, error)
BatchCopyFunctions copies multiple functions
func (*FunctionModel) BatchDeleteFunctions ¶
func (m *FunctionModel) BatchDeleteFunctions(ctx context.Context, functionIDs []string) (int, []string, error)
BatchDeleteFunctions deletes multiple functions
func (*FunctionModel) BatchUpdateStatus ¶
func (m *FunctionModel) BatchUpdateStatus(ctx context.Context, functionIDs []string, enabled bool) (int, []string, error)
BatchUpdateStatus updates status for multiple functions
func (*FunctionModel) CopyFunction ¶
CopyFunction creates a copy of a function with a new ID
func (*FunctionModel) Create ¶
func (m *FunctionModel) Create(ctx context.Context, fn *Function) error
Create inserts a new function record.
func (*FunctionModel) Delete ¶
func (m *FunctionModel) Delete(ctx context.Context, id uint) error
Delete removes a function.
func (*FunctionModel) DeleteFunction ¶
func (m *FunctionModel) DeleteFunction(ctx context.Context, functionID string) error
DeleteFunction deletes a function by function_id
func (*FunctionModel) DeletePending ¶
func (m *FunctionModel) DeletePending(ctx context.Context, functionID string) error
DeletePending removes a pending function.
func (*FunctionModel) FindByFunctionID ¶
FindByFunctionID fetches by external function ID.
func (*FunctionModel) List ¶
func (m *FunctionModel) List(ctx context.Context, opts ListFunctionsOptions) ([]Function, int64, error)
List returns paginated functions.
func (*FunctionModel) ListDescriptorTemplates ¶
func (m *FunctionModel) ListDescriptorTemplates(ctx context.Context, category string) ([]Descriptor, error)
ListDescriptorTemplates returns reusable descriptors filtered by category.
func (*FunctionModel) ListDescriptors ¶
func (m *FunctionModel) ListDescriptors(ctx context.Context, functionID string) ([]FunctionDescriptor, error)
ListDescriptors fetches descriptors for a function.
func (*FunctionModel) ListFunctionMenus ¶
func (m *FunctionModel) ListFunctionMenus(ctx context.Context) (map[string]map[string]interface{}, error)
ListFunctionMenus returns function_id -> metadata.menu map.
func (*FunctionModel) ListInstances ¶
func (m *FunctionModel) ListInstances(ctx context.Context, functionID string) ([]FunctionInstance, error)
ListInstances returns function instances.
func (*FunctionModel) ListPending ¶
func (m *FunctionModel) ListPending(ctx context.Context) ([]PendingFunction, error)
ListPending returns pending submissions.
func (*FunctionModel) ListPermissions ¶
func (m *FunctionModel) ListPermissions(ctx context.Context, functionID string) ([]FunctionPermission, error)
ListPermissions returns function permissions.
func (*FunctionModel) RegisterInstance ¶
func (m *FunctionModel) RegisterInstance(ctx context.Context, instance *FunctionInstance) error
RegisterInstance upserts instance heartbeat data.
func (*FunctionModel) ReplacePermissions ¶
func (m *FunctionModel) ReplacePermissions(ctx context.Context, functionID string, perms []FunctionPermission) error
ReplacePermissions fully replaces permissions for a function.
func (*FunctionModel) SavePendingFunction ¶
func (m *FunctionModel) SavePendingFunction(ctx context.Context, pending *PendingFunction) error
SavePendingFunction upserts pending change set.
func (*FunctionModel) UpsertDescriptor ¶
func (m *FunctionModel) UpsertDescriptor(ctx context.Context, desc *FunctionDescriptor) error
UpsertDescriptor stores descriptor metadata.
type FunctionPermission ¶
type FunctionPermission struct {
gorm.Model
FunctionID string `gorm:"size:64;index"`
GameID string `gorm:"size:64;index"`
Env string `gorm:"size:64;index"`
Resource string `gorm:"size:64"`
Actions datatypes.JSON `gorm:"type:json"`
Roles datatypes.JSON `gorm:"type:json"`
}
FunctionPermission stores per-function permission mapping.
func (FunctionPermission) TableName ¶
func (FunctionPermission) TableName() string
type Game ¶
type Game struct {
gorm.Model
Name string `gorm:"size:128;not null;index"`
Icon string `gorm:"size:255"`
Description string `gorm:"type:text"`
Enabled bool `gorm:"default:true;index"`
AliasName string `gorm:"size:64;uniqueIndex"`
Homepage string `gorm:"size:255"`
Status string `gorm:"size:32;default:'dev';index"` // dev, test, running, online, offline, maintenance
GameType string `gorm:"size:64;index"`
GenreCode string `gorm:"size:64;index"`
Config string `gorm:"type:text"` // 游戏配置 JSON
Color string `gorm:"size:32"`
Envs datatypes.JSON `gorm:"type:json"` // 环境列表 JSON
}
Game 游戏结构体
type GameEnv ¶
type GameEnv struct {
Env string `json:"env"`
Description string `json:"description,omitempty"`
Color string `json:"color,omitempty"`
}
GameEnv 游戏环境项
type GameModel ¶
type GameModel struct {
// contains filtered or unexported fields
}
GameModel 提供游戏数据访问方法
func (*GameModel) ExistsByNameIgnoreCase ¶
func (m *GameModel) ExistsByNameIgnoreCase(ctx context.Context, name string, excludeID ...uint) (bool, error)
ExistsByNameIgnoreCase checks whether a game name already exists.
func (*GameModel) FindByGameID ¶
FindByGameID 根据 GameID 获取游戏
func (*GameModel) FindByName ¶
FindByName 根据名称获取游戏
func (*GameModel) ToggleEnabled ¶
ToggleEnabled 切换游戏启用状态
type ListAdminsOptions ¶
ListAdminsOptions controls pagination and filtering for listing admins.
type ListAlertsOptions ¶
type ListAlertsOptions struct {
PaginationOptions
Level string
Status string
Source string
}
ListAlertsOptions controls filtering/pagination.
type ListBackupsOptions ¶
type ListBackupsOptions struct {
PaginationOptions
Type string
}
ListBackupsOptions controls list filtering.
type ListCertificatesOptions ¶
ListCertificatesOptions controls pagination/filtering.
type ListEntitiesOptions ¶
ListEntitiesOptions 控制实体列表查询的分页和过滤选项
type ListFAQOptions ¶
type ListFAQOptions struct {
PaginationOptions
Category string
Keyword string
Visible *bool
}
ListFAQOptions controls listing.
type ListFeedbackOptions ¶
type ListFeedbackOptions struct {
PaginationOptions
GameID string
Env string
Status string
Category string
Keyword string
}
ListFeedbackOptions controls filtering.
type ListFunctionsOptions ¶
type ListFunctionsOptions struct {
PaginationOptions
GameID string
Category string
Status *int
Search string
}
ListFunctionsOptions controls listing.
type ListGamesOptions ¶
ListGamesOptions 控制游戏列表查询的分页和过滤选项
type ListMessagesOptions ¶
ListMessagesOptions controls pagination/filtering.
type ListNodesOptions ¶
ListNodesOptions controls filtering.
type ListPermissionsOptions ¶
ListPermissionsOptions controls pagination/filtering.
type ListPlayersOptions ¶
type ListPlayersOptions struct {
Page int
PageSize int
GameID string
Search string
Status *int
Level *int
VIP *int
}
ListPlayersOptions 控制玩家列表查询的分页和过滤选项
type ListRolesOptions ¶
ListRolesOptions controls pagination/filtering when listing roles.
type ListSilencesOptions ¶
type ListSilencesOptions struct {
ActiveOnly bool
}
ListSilencesOptions filters silence entries.
type ListTicketsOptions ¶
type ListTicketsOptions struct {
PaginationOptions
Status string
}
ListTicketsOptions controls filtering.
type Message ¶
type Message struct {
gorm.Model
To string `gorm:"size:255;not null;index:idx_messages_to_status,priority:1;index:idx_messages_to_created"`
Type string `gorm:"size:64;not null;index"`
Title string `gorm:"size:255"`
Content string `gorm:"type:text"`
Data datatypes.JSON `gorm:"type:json"`
Status string `gorm:"size:32;default:'unread';index:idx_messages_to_status,priority:2;index:idx_messages_status_created"`
ReadAt *time.Time `gorm:"index"`
}
Message represents system/user notifications.
type MessageModel ¶
type MessageModel struct {
// contains filtered or unexported fields
}
MessageModel exposes CRUD helpers for messages.
func NewMessageModel ¶
func NewMessageModel(db *gorm.DB) *MessageModel
NewMessageModel creates a message model.
func (*MessageModel) CountUnread ¶
CountUnread returns number of unread messages (optionally filtered by recipient).
func (*MessageModel) Create ¶
func (m *MessageModel) Create(ctx context.Context, msg *Message) error
Create inserts a new message.
func (*MessageModel) List ¶
func (m *MessageModel) List(ctx context.Context, opts ListMessagesOptions) ([]Message, int64, error)
List returns paginated messages with filters applied.
type Node ¶
type Node struct {
gorm.Model
NodeID string `gorm:"size:64;uniqueIndex"`
Name string `gorm:"size:128"`
Type string `gorm:"size:32;index"`
Status string `gorm:"size:32;index"`
IP string `gorm:"size:64"`
Port int
Resources datatypes.JSONMap `gorm:"type:json"`
Meta datatypes.JSONMap `gorm:"type:json"`
}
Node stores managed node metadata.
type NodeCommand ¶
type NodeCommand struct {
gorm.Model
Name string `gorm:"size:64;uniqueIndex"`
Description string `gorm:"size:255"`
}
NodeCommand describes an available agent command.
func (NodeCommand) TableName ¶
func (NodeCommand) TableName() string
type NodeModel ¶
type NodeModel struct {
// contains filtered or unexported fields
}
NodeModel manages node metadata.
func (*NodeModel) FindByNodeID ¶
FindByNodeID fetches a node by its node_id.
func (*NodeModel) ListCommands ¶
func (m *NodeModel) ListCommands(ctx context.Context) ([]NodeCommand, error)
ListCommands returns registered commands.
func (*NodeModel) UpdateMeta ¶
func (m *NodeModel) UpdateMeta(ctx context.Context, nodeID string, updates map[string]interface{}) error
UpdateMeta updates node metadata map.
func (*NodeModel) UpdateStatus ¶
UpdateStatus updates node status.
func (*NodeModel) UpsertCommand ¶
func (m *NodeModel) UpsertCommand(ctx context.Context, command *NodeCommand) error
UpsertCommand stores a node command.
type PaginationOptions ¶
通用分页选项
type PaymentQueryOptions ¶
type PaymentQueryOptions struct {
PaginationOptions
GameID string
Env string
Status string
StartTime time.Time
EndTime time.Time
}
PaymentQueryOptions controls transaction queries.
type PaymentTransaction ¶
type PaymentTransaction struct {
gorm.Model
TransactionID string `gorm:"size:64;uniqueIndex"`
GameID string `gorm:"size:64;index"`
Env string `gorm:"size:32;index"`
UserID string `gorm:"size:64;index"`
ProductID string `gorm:"size:64;index"`
ProductName string `gorm:"size:128"`
Amount float64
Currency string `gorm:"size:16"`
Status string `gorm:"size:32;index"`
PaymentMethod string `gorm:"size:32"`
Metadata datatypes.JSONMap `gorm:"type:json"`
OccurredAt time.Time `gorm:"index"`
}
PaymentTransaction records a single payment event.
func (PaymentTransaction) TableName ¶
func (PaymentTransaction) TableName() string
type PaymentsModel ¶
type PaymentsModel struct {
// contains filtered or unexported fields
}
PaymentsModel handles payment analytics persistence.
func NewPaymentsModel ¶
func NewPaymentsModel(db *gorm.DB) *PaymentsModel
NewPaymentsModel creates a new payments model helper.
func (*PaymentsModel) AggregateRevenue ¶
func (m *PaymentsModel) AggregateRevenue(ctx context.Context, gameID, env string, start, end time.Time) (RevenueAggregate, error)
AggregateRevenue returns revenue, paying users, and transaction counts for the window.
func (*PaymentsModel) CreateTransaction ¶
func (m *PaymentsModel) CreateTransaction(ctx context.Context, tx *PaymentTransaction) error
CreateTransaction records a new transaction.
func (*PaymentsModel) DailyRevenue ¶
func (m *PaymentsModel) DailyRevenue(ctx context.Context, gameID, env string, start, end time.Time) ([]DailyRevenueStat, error)
DailyRevenue aggregates revenue per day within the range.
func (*PaymentsModel) ListProductTrends ¶
func (m *PaymentsModel) ListProductTrends(ctx context.Context, gameID, env string) ([]ProductTrend, error)
ListProductTrends fetches trend snapshots.
func (*PaymentsModel) ListTransactions ¶
func (m *PaymentsModel) ListTransactions(ctx context.Context, opts PaymentQueryOptions) ([]PaymentTransaction, int64, error)
ListTransactions returns paginated transactions.
func (*PaymentsModel) UpsertProductTrend ¶
func (m *PaymentsModel) UpsertProductTrend(ctx context.Context, trend *ProductTrend) error
UpsertProductTrend stores aggregated product trend data.
type PendingFunction ¶
type PendingFunction struct {
gorm.Model
FunctionID string `gorm:"size:64;uniqueIndex"`
Payload datatypes.JSONMap `gorm:"type:json"`
RequestedBy string `gorm:"size:64"`
Status string `gorm:"size:32"`
}
PendingFunction stores functions awaiting approval.
func (PendingFunction) TableName ¶
func (PendingFunction) TableName() string
type Permission ¶
type Permission struct {
ID string `gorm:"primaryKey;size:64;not null"`
Name string `gorm:"size:128;not null"`
Description string `gorm:"type:text"`
Resource string `gorm:"size:128;not null"`
Action string `gorm:"size:64;not null"`
Category string `gorm:"size:64;not null"`
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index"`
}
Permission represents RBAC permissions.
func (Permission) TableName ¶
func (Permission) TableName() string
TableName implements gorm's tabler interface.
type PermissionModel ¶
type PermissionModel struct {
// contains filtered or unexported fields
}
PermissionModel exposes query helpers for permissions.
func NewPermissionModel ¶
func NewPermissionModel(db *gorm.DB) *PermissionModel
NewPermissionModel constructs a PermissionModel.
func (*PermissionModel) FindOne ¶
func (m *PermissionModel) FindOne(ctx context.Context, id string) (*Permission, error)
FindOne fetches a permission by ID.
func (*PermissionModel) List ¶
func (m *PermissionModel) List(ctx context.Context, opts ListPermissionsOptions) ([]Permission, int64, error)
List fetches permissions using filters.
type Player ¶
type Player struct {
gorm.Model
Username string `gorm:"size:64;not null;index:idx_player_username_game,priority:1"`
Nickname string `gorm:"size:128;index"`
Email string `gorm:"size:256;index"`
Phone string `gorm:"size:32;index"`
GameID string `gorm:"size:64;index:idx_player_game_status,priority:1;index:idx_player_username_game,priority:2;not null"`
Status int `gorm:"default:1;index:idx_player_game_status,priority:2"` // 1:active 0:banned 2:suspended
Balance int64 `gorm:"default:0;index"` // 游戏货币
Level int `gorm:"default:1;index"`
VIP int `gorm:"column:vip;default:0;index"` // Column name explicitly set to 'vip'
Password string `gorm:"size:255"` // 密码哈希
}
Player 玩家结构体 (对应 player.api)
type PlayerModel ¶
type PlayerModel struct {
// contains filtered or unexported fields
}
PlayerModel 提供玩家数据访问方法
func (*PlayerModel) ActivatePlayer ¶
func (m *PlayerModel) ActivatePlayer(ctx context.Context, id uint) error
ActivatePlayer 激活玩家
func (*PlayerModel) BanPlayer ¶
func (m *PlayerModel) BanPlayer(ctx context.Context, id uint) error
BanPlayer 封禁玩家
func (*PlayerModel) CountNewPlayers ¶
func (m *PlayerModel) CountNewPlayers(ctx context.Context, gameID string, start, end time.Time) (int64, error)
CountNewPlayers returns the number of players created in the provided window.
func (*PlayerModel) DailyNewPlayers ¶
func (m *PlayerModel) DailyNewPlayers(ctx context.Context, gameID string, start, end time.Time) ([]DailyNewPlayerStat, error)
DailyNewPlayers aggregates new player counts per day within the window.
func (*PlayerModel) Delete ¶
func (m *PlayerModel) Delete(ctx context.Context, id uint) error
Delete 删除玩家
func (*PlayerModel) FindByUsername ¶
func (m *PlayerModel) FindByUsername(ctx context.Context, username string, gameID string) (*Player, error)
FindByUsername 根据用户名获取玩家
func (*PlayerModel) List ¶
func (m *PlayerModel) List(ctx context.Context, opts ListPlayersOptions) ([]Player, int64, error)
List 分页获取玩家列表
func (*PlayerModel) SuspendPlayer ¶
func (m *PlayerModel) SuspendPlayer(ctx context.Context, id uint) error
SuspendPlayer 暂停玩家
func (*PlayerModel) UpdateBalance ¶
func (m *PlayerModel) UpdateBalance(ctx context.Context, id uint, amount int64, reason string) (*Player, error)
UpdateBalance 更新玩家余额
func (*PlayerModel) UpdatePassword ¶
UpdatePassword 更新玩家密码
func (*PlayerModel) ValidatePassword ¶
func (m *PlayerModel) ValidatePassword(ctx context.Context, username, password, gameID string) (*Player, error)
ValidatePassword 验证玩家密码
type ProductTrend ¶
type ProductTrend struct {
gorm.Model
GameID string `gorm:"size:64;index"`
Env string `gorm:"size:32;index"`
ProductID string `gorm:"size:64;index:idx_product_window,unique"`
ProductName string `gorm:"size:128"`
Revenue float64
Sales int
Growth float64
WindowStart time.Time `gorm:"index:idx_product_window,unique"`
WindowEnd time.Time
}
ProductTrend stores aggregated metrics per product.
func (ProductTrend) TableName ¶
func (ProductTrend) TableName() string
type ProfileGame ¶
type ProfileGame struct {
gorm.Model
AdminID uint `gorm:"index"`
GameID string `gorm:"size:64"`
GameName string `gorm:"size:128"`
Color string `gorm:"size:32"`
Envs datatypes.JSON `gorm:"type:json"`
Permissions datatypes.JSON `gorm:"type:json"`
}
ProfileGame stores admin game access summary.
func (ProfileGame) TableName ¶
func (ProfileGame) TableName() string
type ProfileModel ¶
type ProfileModel struct {
// contains filtered or unexported fields
}
ProfileModel provides helpers for profile-related views.
func NewProfileModel ¶
func NewProfileModel(db *gorm.DB) *ProfileModel
NewProfileModel creates helper.
func (*ProfileModel) ListGames ¶
func (m *ProfileModel) ListGames(ctx context.Context, adminID uint) ([]ProfileGame, error)
ListGames returns cached games.
func (*ProfileModel) ListPermissions ¶
func (m *ProfileModel) ListPermissions(ctx context.Context, adminID uint) ([]ProfilePermission, error)
ListPermissions returns cached permissions.
func (*ProfileModel) ReplaceGames ¶
func (m *ProfileModel) ReplaceGames(ctx context.Context, adminID uint, games []ProfileGame) error
ReplaceGames replaces cached game scopes.
func (*ProfileModel) ReplacePermissions ¶
func (m *ProfileModel) ReplacePermissions(ctx context.Context, adminID uint, perms []ProfilePermission) error
ReplacePermissions replaces cached permissions for an admin.
type ProfilePermission ¶
type ProfilePermission struct {
gorm.Model
AdminID uint `gorm:"index"`
Resource string `gorm:"size:64"`
GameID string `gorm:"size:64"`
Env string `gorm:"size:32"`
Actions datatypes.JSON `gorm:"type:json"`
}
ProfilePermission stores cached permission info per admin.
func (ProfilePermission) TableName ¶
func (ProfilePermission) TableName() string
type RateLimit ¶
type RateLimit struct {
gorm.Model
RateLimitID string `gorm:"size:64;uniqueIndex"`
Name string `gorm:"size:128"`
Resource string `gorm:"size:64"`
Limit int
Window int
Action string `gorm:"size:32"`
Rules datatypes.JSONMap `gorm:"type:json"`
Status int `gorm:"default:1"`
}
RateLimit represents throttling configurations.
type RateLimitModel ¶
type RateLimitModel struct {
// contains filtered or unexported fields
}
RateLimitModel manages rate limit configs.
func NewRateLimitModel ¶
func NewRateLimitModel(db *gorm.DB) *RateLimitModel
NewRateLimitModel creates helper.
func (*RateLimitModel) Delete ¶
func (m *RateLimitModel) Delete(ctx context.Context, id uint) error
Delete removes a rate limit.
func (*RateLimitModel) DeleteByKey ¶
func (m *RateLimitModel) DeleteByKey(ctx context.Context, key string) error
DeleteByKey removes a rate limit by RateLimitID.
type RetentionCohort ¶
type RetentionCohort struct {
gorm.Model
GameID string `gorm:"size:64;index"`
Env string `gorm:"size:32;index"`
Cohort string `gorm:"size:32;index"`
Users int `gorm:"default:0"`
Retention datatypes.JSON `gorm:"type:json"`
WindowStart time.Time
WindowEnd time.Time
}
RetentionCohort stores cohort retention metrics.
func (RetentionCohort) TableName ¶
func (RetentionCohort) TableName() string
type RetentionModel ¶
type RetentionModel struct {
// contains filtered or unexported fields
}
RetentionModel manages cohort persistence.
func NewRetentionModel ¶
func NewRetentionModel(db *gorm.DB) *RetentionModel
NewRetentionModel creates a retention model helper.
func (*RetentionModel) ListCohorts ¶
func (m *RetentionModel) ListCohorts(ctx context.Context, gameID, env, cohortName string) ([]RetentionCohort, error)
ListCohorts fetches retention cohorts for filters.
func (*RetentionModel) UpsertCohort ¶
func (m *RetentionModel) UpsertCohort(ctx context.Context, cohort *RetentionCohort) error
UpsertCohort stores cohort metrics.
type RevenueAggregate ¶
RevenueAggregate summarizes revenue data for a period.
type Role ¶
type Role struct {
gorm.Model
Name string `gorm:"uniqueIndex;size:64;not null"`
Description string `gorm:"size:256"`
Category string `gorm:"size:64;index"`
}
Role represents RBAC roles.
type RoleModel ¶
type RoleModel struct {
// contains filtered or unexported fields
}
RoleModel exposes CRUD helpers for Role + Permission relationships.
func (*RoleModel) GetRolePermissionIDs ¶
GetRolePermissionIDs returns permission IDs attached to the role.
func (*RoleModel) GetRolesPermissionIDs ¶
func (m *RoleModel) GetRolesPermissionIDs(ctx context.Context, roleIDs []uint) (map[uint][]string, error)
GetRolesPermissionIDs fetches permission IDs for multiple roles.
func (*RoleModel) ReplacePermissions ¶
func (m *RoleModel) ReplacePermissions(ctx context.Context, roleID uint, permissionIDs []string) error
ReplacePermissions rewrites role_permissions entries for the given role.
type RolePermission ¶
type RolePermission struct {
gorm.Model
RoleID uint `gorm:"index:idx_role_permissions_role_id;not null"`
PermissionID string `gorm:"index:idx_role_permissions_permission_id;size:64;not null"`
}
RolePermission links roles and permissions.
func (RolePermission) TableName ¶
func (RolePermission) TableName() string
TableName implements gorm's tabler interface.
type SupportComment ¶
type SupportComment struct {
gorm.Model
TicketID uint `gorm:"index"`
Author string `gorm:"size:64"`
Content string `gorm:"type:text"`
Attach string `gorm:"type:text"`
}
SupportComment stores comments for support tickets.
func (SupportComment) TableName ¶
func (SupportComment) TableName() string
type SupportFAQ ¶
type SupportFAQ struct {
gorm.Model
Question string `gorm:"type:text"`
Answer string `gorm:"type:text"`
Category string `gorm:"size:64"`
Tags string `gorm:"size:255"`
Visible bool `gorm:"default:true"`
Sort int `gorm:"default:0"`
}
SupportFAQ mirrors FAQ entries in the support context.
func (SupportFAQ) TableName ¶
func (SupportFAQ) TableName() string
type SupportFeedback ¶
type SupportFeedback struct {
gorm.Model
PlayerID string `gorm:"size:64"`
Contact string `gorm:"size:128"`
Content string `gorm:"type:text"`
Category string `gorm:"size:64"`
Priority string `gorm:"size:16"`
Status string `gorm:"size:32"`
Attach string `gorm:"type:text"`
GameID string `gorm:"size:64"`
Env string `gorm:"size:64"`
}
SupportFeedback stores support feedback.
func (SupportFeedback) TableName ¶
func (SupportFeedback) TableName() string
type SupportModel ¶
type SupportModel struct {
// contains filtered or unexported fields
}
SupportModel wraps support data operations.
func NewSupportModel ¶
func NewSupportModel(db *gorm.DB) *SupportModel
NewSupportModel creates helper.
func (*SupportModel) CreateComment ¶
func (m *SupportModel) CreateComment(ctx context.Context, comment *SupportComment) error
CreateComment inserts ticket comment.
func (*SupportModel) CreateFAQ ¶
func (m *SupportModel) CreateFAQ(ctx context.Context, faq *SupportFAQ) error
CreateFAQ inserts FAQ.
func (*SupportModel) CreateFeedback ¶
func (m *SupportModel) CreateFeedback(ctx context.Context, feedback *SupportFeedback) error
CreateFeedback inserts support feedback.
func (*SupportModel) CreateTicket ¶
func (m *SupportModel) CreateTicket(ctx context.Context, ticket *SupportTicket) error
CreateTicket inserts ticket.
func (*SupportModel) DeleteTicket ¶
func (m *SupportModel) DeleteTicket(ctx context.Context, id uint) error
DeleteTicket deletes ticket.
func (*SupportModel) ListComments ¶
func (m *SupportModel) ListComments(ctx context.Context, ticketID uint) ([]SupportComment, error)
ListComments fetches ticket comments.
func (*SupportModel) ListFAQs ¶
func (m *SupportModel) ListFAQs(ctx context.Context) ([]SupportFAQ, error)
ListFAQs returns FAQs.
func (*SupportModel) ListFeedback ¶
func (m *SupportModel) ListFeedback(ctx context.Context) ([]SupportFeedback, error)
ListFeedback returns support feedback entries.
func (*SupportModel) ListTickets ¶
func (m *SupportModel) ListTickets(ctx context.Context, opts ListTicketsOptions) ([]SupportTicket, int64, error)
ListTickets returns paginated tickets.
func (*SupportModel) UpdateTicket ¶
func (m *SupportModel) UpdateTicket(ctx context.Context, id uint, updates map[string]interface{}) error
UpdateTicket updates ticket fields.
type SupportTicket ¶
type SupportTicket struct {
gorm.Model
Title string `gorm:"size:255"`
Content string `gorm:"type:text"`
Category string `gorm:"size:64"`
Priority string `gorm:"size:16"`
Status string `gorm:"size:32;index"`
Assignee string `gorm:"size:64"`
Tags string `gorm:"size:255"`
PlayerID string `gorm:"size:64"`
Contact string `gorm:"size:128"`
GameID string `gorm:"size:64;index"`
Env string `gorm:"size:64"`
Source string `gorm:"size:32"`
DueAt *time.Time
}
SupportTicket captures support ticket data.
func (SupportTicket) TableName ¶
func (SupportTicket) TableName() string
type TermDictionary ¶
type TermDictionary struct {
ID uint `gorm:"primaryKey"`
Domain string `gorm:"size:32;not null;index:idx_term_domain_key,priority:1;uniqueIndex:uidx_term_domain_alias,priority:1"`
TermKey string `gorm:"size:64;not null;index:idx_term_domain_key,priority:2"`
Alias string `gorm:"size:128;not null;uniqueIndex:uidx_term_domain_alias,priority:2"`
DisplayZh string `gorm:"size:128"`
DisplayEn string `gorm:"size:128"`
SortOrder int `gorm:"default:100"`
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index"`
}
TermDictionary stores normalized game terminology entries used by UI/menu grouping.
func (TermDictionary) TableName ¶
func (TermDictionary) TableName() string
type TermDictionaryModel ¶
type TermDictionaryModel struct {
// contains filtered or unexported fields
}
func NewTermDictionaryModel ¶
func NewTermDictionaryModel(db *gorm.DB) *TermDictionaryModel
func (*TermDictionaryModel) DeleteByAlias ¶
func (m *TermDictionaryModel) DeleteByAlias(ctx context.Context, domain, alias string) error
func (*TermDictionaryModel) List ¶
func (m *TermDictionaryModel) List(ctx context.Context, domain string) ([]TermDictionary, error)
func (*TermDictionaryModel) Upsert ¶
func (m *TermDictionaryModel) Upsert(ctx context.Context, item *TermDictionary) error
type Ticket ¶
type Ticket struct {
gorm.Model
Title string `gorm:"size:255"`
Content string `gorm:"type:text"`
Category string `gorm:"size:64;index:idx_ticket_category_status"`
Priority string `gorm:"size:16;index"`
Status string `gorm:"size:32;index:idx_ticket_status;index:idx_ticket_category_status"`
Assignee string `gorm:"size:64;index"`
Tags datatypes.JSON `gorm:"type:json"`
PlayerID string `gorm:"size:64;index"`
Contact string `gorm:"size:128"`
GameID string `gorm:"size:64;index:idx_ticket_game_env,priority:1"`
Env string `gorm:"size:64;index:idx_ticket_game_env,priority:2"`
Source string `gorm:"size:32;index"`
DueAt *time.Time `gorm:"index"`
}
Ticket represents the primary ticketing model for /tickets API.
type TicketComment ¶
type TicketComment struct {
gorm.Model
TicketID uint `gorm:"index"`
Author string `gorm:"size:64"`
Content string `gorm:"type:text"`
}
TicketComment stores comments under /tickets module.
func (TicketComment) TableName ¶
func (TicketComment) TableName() string
type TicketModel ¶
type TicketModel struct {
// contains filtered or unexported fields
}
TicketModel manages ticket entities for the ticket module.
func (*TicketModel) Create ¶
func (m *TicketModel) Create(ctx context.Context, ticket *Ticket) error
Create inserts a ticket.
func (*TicketModel) CreateComment ¶
func (m *TicketModel) CreateComment(ctx context.Context, comment *TicketComment) error
CreateComment inserts ticket comment.
func (*TicketModel) Delete ¶
func (m *TicketModel) Delete(ctx context.Context, id uint) error
Delete removes a ticket.
func (*TicketModel) List ¶
func (m *TicketModel) List(ctx context.Context, opts TicketQueryOptions) ([]Ticket, int64, error)
List returns paginated tickets.
func (*TicketModel) ListComments ¶
func (m *TicketModel) ListComments(ctx context.Context, ticketID uint) ([]TicketComment, error)
ListComments fetches ticket comments.
type TicketQueryOptions ¶
type TicketQueryOptions struct {
PaginationOptions
Status string
Category string
Priority string
Assignee string
}
ListTicketsOptions controls filtering.
type TimestampMixin ¶
type TimestampMixin struct {
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
}
通用更新时间跟踪
type WorkspaceConfig ¶
type WorkspaceConfig struct {
gorm.Model
ObjectKey string `gorm:"size:128;uniqueIndex"`
Title string `gorm:"size:256"`
Published bool `gorm:"default:false"`
PublishedAt *time.Time `gorm:"index"`
PublishedBy string `gorm:"size:128"`
MenuOrder int `gorm:"default:0"`
Config datatypes.JSON `gorm:"type:json"` // full JSON blob
}
WorkspaceConfig stores workspace UI configuration as a JSON blob.
func (WorkspaceConfig) TableName ¶
func (WorkspaceConfig) TableName() string
type WorkspaceConfigModel ¶
type WorkspaceConfigModel struct {
// contains filtered or unexported fields
}
WorkspaceConfigModel wraps data access for workspace configs.
func NewWorkspaceConfigModel ¶
func NewWorkspaceConfigModel(db *gorm.DB) *WorkspaceConfigModel
func (*WorkspaceConfigModel) Delete ¶
func (m *WorkspaceConfigModel) Delete(ctx context.Context, objectKey string) error
Delete removes a workspace config by objectKey.
func (*WorkspaceConfigModel) FindByObjectKey ¶
func (m *WorkspaceConfigModel) FindByObjectKey(ctx context.Context, objectKey string) (*WorkspaceConfig, error)
FindByObjectKey fetches a workspace config by objectKey.
func (*WorkspaceConfigModel) ListAll ¶
func (m *WorkspaceConfigModel) ListAll(ctx context.Context) ([]WorkspaceConfig, error)
ListAll returns all workspace configs ordered by menu_order.
func (*WorkspaceConfigModel) ListPublished ¶
func (m *WorkspaceConfigModel) ListPublished(ctx context.Context) ([]WorkspaceConfig, error)
ListPublished returns all published workspace configs ordered by menu_order.
func (*WorkspaceConfigModel) SetPublished ¶
func (m *WorkspaceConfigModel) SetPublished(ctx context.Context, objectKey string, published bool, publishedBy string) error
SetPublished updates the published state of a workspace config.
func (*WorkspaceConfigModel) Upsert ¶
func (m *WorkspaceConfigModel) Upsert(ctx context.Context, cfg *WorkspaceConfig) error
Upsert creates or fully replaces a workspace config by objectKey.
Source Files
¶
- admin.go
- admin_model.go
- admin_role.go
- admin_scope.go
- agent_session_model.go
- alert.go
- alert_model.go
- analytics_behavior.go
- analytics_behavior_model.go
- analytics_payments.go
- analytics_payments_model.go
- analytics_retention.go
- analytics_retention_model.go
- backup.go
- backup_model.go
- certificate.go
- certificate_model.go
- config_version.go
- entity.go
- entity_model.go
- extension_catalog.go
- extension_event.go
- extension_installation.go
- extension_release.go
- extension_runtime_binding.go
- faq.go
- faq_model.go
- feedback.go
- feedback_model.go
- function.go
- function_model.go
- game.go
- game_model.go
- helpers.go
- message.go
- message_model.go
- migration.go
- migration_agent_sessions.go
- node.go
- node_model.go
- permission.go
- permission_model.go
- player.go
- player_model.go
- profile.go
- profile_model.go
- rate_limit.go
- rate_limit_model.go
- role.go
- role_model.go
- role_permission.go
- support.go
- support_model.go
- term_dictionary.go
- term_dictionary_model.go
- ticket.go
- ticket_model.go
- vars.go
- workspace_config.go