do

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExternalCustomerFieldName         = "name"
	ExternalCustomerFieldAddress      = "address"
	ExternalCustomerFieldContact      = "contact"
	ExternalCustomerFieldPhone        = "phone"
	ExternalCustomerFieldEmail        = "email"
	ExternalCustomerFieldRemark       = "remark"
	ExternalCustomerFieldStatus       = "status"
	ExternalCustomerPreloadFieldHooks = "Hooks"
)
View Source
const (
	ExternalCustomerHookFieldHook            = "hook"
	ExternalCustomerHookFieldHookName        = "hook_name"
	ExternalCustomerHookFieldStatus          = "status"
	ExternalCustomerHookFieldNotifyApp       = "notify_app"
	ExternalCustomerHookFieldRemark          = "remark"
	ExternalCustomerHookFieldCustomerId      = "customer_id"
	ExternalCustomerHookPreloadFieldCustomer = "Customer"
)
View Source
const (
	MyChartFieldUserId = "user_id"
	MyChartFieldTitle  = "title"
	MyChartFieldUrl    = "url"
	MyChartFieldStatus = basescopes.BaseFieldStatus
	MyChartFieldRemark = basescopes.BaseFieldRemark
)
View Source
const (
	MyDashboardConfigFieldTitle         = "title"
	MyDashboardConfigFieldColor         = "color"
	MyDashboardConfigFieldUserId        = "user_id"
	MyDashboardConfigFieldRemark        = basescopes.BaseFieldRemark
	MyDashboardConfigFieldStatus        = basescopes.BaseFieldStatus
	MyDashboardConfigPreloadFieldCharts = "Charts"
)
View Source
const (
	PromAlarmBeenNotifyChatGroupFieldRealtimeAlarmID   = "realtime_alarm_id"
	PromAlarmBeenNotifyChatGroupFieldChatGroupId       = "chat_group_id"
	PromAlarmBeenNotifyChatGroupFieldStatus            = "status"
	PromAlarmBeenNotifyChatGroupFieldMsg               = "msg"
	PromAlarmBeenNotifyChatGroupFieldPromAlarmNotifyID = "prom_alarm_notify_id"
	PromAlarmBeenNotifyChatGroupPreloadFieldChatGroup  = "ChatGroup"
)
View Source
const (
	PromAlarmBeenNotifyMemberFieldRealtimeAlarmID        = "realtime_alarm_id"
	PromAlarmBeenNotifyMemberFieldNotifyTypes            = "notify_types"
	PromAlarmBeenNotifyMemberFieldMemberId               = "member_id"
	PromAlarmBeenNotifyMemberFieldMsg                    = "msg"
	PromAlarmBeenNotifyMemberFieldStatus                 = "status"
	PromAlarmBeenNotifyMemberFieldPromAlarmNotifyID      = "prom_alarm_notify_id"
	PromAlarmBeenNotifyMemberPreloadFieldPromAlarmNotify = "PromAlarmNotify"
	PromAlarmBeenNotifyMemberPreloadFieldMember          = "Member"
)
View Source
const (
	PromAlarmChatGroupFieldStatus    = "status"
	PromAlarmChatGroupFieldRemark    = "remark"
	PromAlarmChatGroupFieldName      = "name"
	PromAlarmChatGroupFieldHook      = "hook"
	PromAlarmChatGroupFieldNotifyApp = "notify_app"
	PromAlarmChatGroupFieldHookName  = "hook_name"
	PromAlarmChatGroupFieldTemplate  = "template"
	PromAlarmChatGroupFieldTitle     = "title"
	PromAlarmChatGroupFieldSecret    = "secret"
	PromAlarmChatGroupFieldCreateBy  = "create_by"

	PromAlarmChatGroupPreloadFieldCreateUser = "CreateUser"
)
View Source
const (
	PromAlarmHistoryFieldInstance        = "instance"
	PromAlarmHistoryFieldStatus          = "status"
	PromAlarmHistoryFieldInfo            = "info"
	PromAlarmHistoryFieldStartAt         = "start_at"
	PromAlarmHistoryFieldEndAt           = "end_at"
	PromAlarmHistoryFieldDuration        = "duration"
	PromAlarmHistoryFieldStrategyID      = "strategy_id"
	PromAlarmHistoryFieldLevelID         = "level_id"
	PromAlarmHistoryFieldMd5             = "md5"
	PromAlarmHistoryPreloadFieldStrategy = "Strategy"
	PromAlarmHistoryPreloadFieldLevel    = "Level"
)
View Source
const (
	PromAlarmInterveneFieldRealtimeAlarmID = "realtime_alarm_id"
	PromAlarmInterveneFieldUserID          = "user_id"
	PromAlarmInterveneFieldIntervenedAt    = "intervened_at"
	PromAlarmInterveneFieldRemark          = "remark"
	PromAlarmIntervenePreloadFieldUserInfo = "UserInfo"
)
View Source
const (
	PromAlarmNotifyFiledName     = basescopes.BaseFieldName
	PromAlarmNotifyFiledStatus   = basescopes.BaseFieldStatus
	PromAlarmNotifyFiledRemark   = basescopes.BaseFieldRemark
	PromAlarmNotifyFiledCreateBy = "create_by"

	PromAlarmNotifyPreloadFieldChatGroups         = "ChatGroups"
	PromAlarmNotifyPreloadFieldBeNotifyMembers    = "BeNotifyMembers"
	PromAlarmNotifyPreloadFieldExternalNotifyObjs = "ExternalNotifyObjs"
)
View Source
const (
	ExternalNotifyObjFieldName                    = "name"
	ExternalNotifyObjFieldRemark                  = "remark"
	ExternalNotifyObjFieldStatus                  = "status"
	ExternalNotifyObjPreloadFieldCustomerList     = "CustomerList"
	ExternalNotifyObjPreloadFieldCustomerHookList = "CustomerHookList"
)
View Source
const (
	PromNotifyMemberFieldPromAlarmNotifyID = "prom_alarm_notify_id"
	PromNotifyMemberFieldStatus            = "status"
	PromNotifyMemberFieldNotifyTypes       = "notify_types"
	PromNotifyMemberFieldMemberId          = "member_id"
	PromNotifyMemberPreloadFieldMember     = "Member"
)
View Source
const (
	PromStrategyAlarmPageFieldPromStrategyID = "prom_strategy_id"
	PromStrategyAlarmPageFieldAlarmPageID    = "sys_dict_id"
)
View Source
const (
	PromAlarmRealtimeFieldStrategyID               = "strategy_id"
	PromAlarmRealtimeFieldLevelID                  = "level_id"
	PromAlarmRealtimeFieldInstance                 = "instance"
	PromAlarmRealtimeFieldNote                     = "note"
	PromAlarmRealtimeFieldStatus                   = "status"
	PromAlarmRealtimeFieldEventAt                  = "event_at"
	PromAlarmRealtimeFieldNotifiedAt               = "notified_at"
	PromAlarmRealtimeFieldHistoryID                = "history_id"
	PromAlarmRealtimePreloadFieldStrategy          = "Strategy"
	PromAlarmRealtimePreloadFieldLevel             = "Level"
	PromAlarmRealtimePreloadFieldHistory           = "History"
	PromAlarmRealtimePreloadFieldIntervenes        = "AlarmIntervenes"
	PromAlarmRealtimePreloadFieldBeenNotifyMembers = "BeenNotifyMembers"
	PromAlarmRealtimePreloadFieldBeenChatGroups    = "BeenChatGroups"
	PromAlarmRealtimePreloadFieldAlarmUpgradeInfo  = "AlarmUpgradeInfo"
	PromAlarmRealtimePreloadFieldAlarmSuppressInfo = "AlarmSuppressInfo"
)
View Source
const (
	PromAlarmSuppressFieldRealtimeAlarmID = "realtime_alarm_id"
	PromAlarmSuppressFieldUserID          = "user_id"
	PromAlarmSuppressFieldSuppressedAt    = "suppressed_at"
	PromAlarmSuppressFieldRemark          = "remark"
	PromAlarmSuppressFieldDuration        = "duration"
	PromAlarmSuppressPreloadFieldUserInfo = "UserInfo"
)
View Source
const (
	PromAlarmUpgradeFieldRealtimeAlarmID = "realtime_alarm_id"
	PromAlarmUpgradeFieldUserID          = "user_id"
	PromAlarmUpgradeFieldUpgradedAt      = "upgraded_at"
	PromAlarmUpgradeFieldRemark          = "remark"
	PromAlarmUpgradePreloadFieldUserInfo = "UserInfo"
)
View Source
const (
	PromDictFieldName     = "name"
	PromDictFieldStatus   = "status"
	PromDictFieldRemark   = "remark"
	PromDictFieldColor    = "color"
	PromDictFieldCategory = "category"

	PromAlarmPageReloadFieldPromStrategies = "PromStrategies"
)
View Source
const (
	EndpointFieldName     = "name"
	EndpointFieldEndpoint = "endpoint"
	EndpointFieldStatus   = "status"
	EndpointFieldRemark   = "remark"
)
View Source
const (
	PromStrategyFieldGroupID                  = "group_id"
	PromStrategyFieldAlert                    = "alert"
	PromStrategyFieldExpr                     = "expr"
	PromStrategyFieldFor                      = "for"
	PromStrategyFieldLabels                   = "labels"
	PromStrategyFieldAnnotations              = "annotations"
	PromStrategyFieldAlertLevelID             = "alert_level_id"
	PromStrategyFieldStatus                   = "status"
	PromStrategyFieldRemark                   = "remark"
	PromStrategyFieldMaxSuppress              = "max_suppress"
	PromStrategyFieldSendRecover              = "send_recover"
	PromStrategyFieldSendInterval             = "send_interval"
	PromStrategyFieldEndpointID               = "endpoint_id"
	PromStrategyFieldCreateBy                 = "create_by"
	PromStrategyPreloadFieldAlarmPages        = "AlarmPages"
	PromStrategyPreloadFieldCategories        = "Categories"
	PromStrategyPreloadFieldAlertLevel        = "AlertLevel"
	PromStrategyPreloadFieldGroupInfo         = "GroupInfo"
	PromStrategyPreloadFieldPromNotifies      = "PromNotifies"
	PromStrategyPreloadFieldPromNotifyUpgrade = "PromNotifyUpgrade"
	PromStrategyPreloadFieldEndpoint          = "Endpoint"
	PromStrategyPreloadFieldCreateByUser      = "CreateByUser"
	PromStrategyPreloadFieldTemplate          = "Templates"
)
View Source
const (
	PromGroupFieldName                  = "name"
	PromGroupFieldStatus                = "status"
	PromGroupFieldRemark                = "remark"
	PromGroupFieldStrategyCount         = "strategy_count"
	PromGroupFieldEnableStrategyCount   = "enable_strategy_count"
	PromGroupPreloadFieldPromStrategies = "PromStrategies"
	PromGroupPreloadFieldCategories     = "Categories"
)
View Source
const (
	SysAPIFieldName         = "name"
	SysAPIFieldPath         = "path"
	SysAPIFieldMethod       = "method"
	SysAPIFieldStatus       = "status"
	SysAPIFieldRemark       = "remark"
	SysAPIFieldModule       = "module"
	SysAPIFieldDomain       = "domain"
	SysAPIPreloadFieldRoles = "Roles"
)
View Source
const (
	SysLogFieldModule      = "module"
	SysLogFieldModuleId    = "module_id"
	SysLogFieldTitle       = "title"
	SysLogFieldContent     = "content"
	SysLogFieldUserId      = "user_id"
	SysLogFieldAction      = "action"
	SysLogPreloadFieldUser = "User"
)
View Source
const (
	SysRoleFieldRemark      = "remark"
	SysRoleFieldName        = "name"
	SysRoleFieldStatus      = "status"
	SysRolePreloadFieldUser = "Users"
	SysRolePreloadFieldApis = "Apis"
)
View Source
const (
	SysUserFieldUsername          = "username"
	SysUserFieldNickname          = "nickname"
	SysUserFieldPhone             = "phone"
	SysUserFieldEmail             = "email"
	SysUserFieldGender            = "gender"
	SysUserFieldStatus            = "status"
	SysUserFieldRemark            = "remark"
	SysUserFieldAvatar            = "avatar"
	SysUserPreloadFieldRoles      = "Roles"
	SysUserPreloadFieldAlarmPages = "AlarmPages"
)
View Source
const (
	PromStrategyNotifyTemplateFieldStrategyID = "strategy_id"
)
View Source
const TableNameCasbinRule = "casbin_rule"
View Source
const TableNameDataRoleOp = "data_role_ops"
View Source
const TableNameDataUserOp = "data_user_ops"
View Source
const TableNameEndpoint = "endpoints"
View Source
const TableNameExternalCustomer = "external_customers"
View Source
const TableNameExternalCustomerHook = "external_customer_hooks"
View Source
const TableNameMyChart = "my_charts"
View Source
const TableNameMyDashboardConfig = "my_dashboard_configs"
View Source
const TableNamePromAlarmBeenNotifyChatGroup = "prom_alarm_been_notify_chat_groups"
View Source
const TableNamePromAlarmHistory = "prom_alarm_histories"
View Source
const TableNamePromAlarmNotifyMember = "prom_alarm_been_notify_members"
View Source
const TableNamePromAlarmRealtime = "prom_alarm_realtime"
View Source
const TableNamePromAlarmSuppress = "prom_alarm_suppress"
View Source
const TableNamePromAlarmUpgrade = "prom_alarm_upgrades"
View Source
const TableNamePromChatGroup = "prom_alarm_chat_groups"
View Source
const TableNamePromDict = "prom_dict"
View Source
const TableNamePromGroup = "prom_strategy_groups"
View Source
const TableNamePromIntervene = "prom_alarm_intervenes"
View Source
const TableNamePromNotify = "prom_alarm_notifies"
View Source
const TableNamePromNotifyExternal = "prom_alarm_external_notify_objs"
View Source
const TableNamePromNotifyMember = "prom_alarm_notify_members"
View Source
const TableNamePromStrategy = "prom_strategies"
View Source
const TableNamePromStrategyAlarmPage = "prom_strategy_alarm_pages"
View Source
const TableNamePromStrategyNotifyTemplate = "prom_strategy_notify_templates"
View Source
const TableNameRole = "sys_roles"
View Source
const TableNameSysApi = "sys_apis"
View Source
const TableNameSysLog = "sys_logs"
View Source
const TableNameSystemUser = "sys_users"
View Source
const TableNameUserRoles = "sys_user_roles"

Variables

This section is empty.

Functions

func CacheAllApiSimple

func CacheAllApiSimple(db *gorm.DB, cacheClient cache.GlobalCache) error

CacheAllApiSimple 缓存所有api简单信息

func CacheApiSimple

func CacheApiSimple(db *gorm.DB, cacheClient cache.GlobalCache, apiIds ...uint32) error

CacheApiSimple 缓存单个api简单信息

func CacheDisabledRoles

func CacheDisabledRoles(db *gorm.DB, cacheClient cache.GlobalCache, roleIds ...uint32) error

CacheDisabledRoles 缓存角色禁用列表

func CacheUserRole

func CacheUserRole(db *gorm.DB, cacheClient cache.GlobalCache, userID uint32) error

CacheUserRole 缓存用户角色关联关系

func CacheUserRoles

func CacheUserRoles(db *gorm.DB, cacheClient cache.GlobalCache) error

CacheUserRoles 缓存用户角色关联关系

func CheckUserRoleExist

func CheckUserRoleExist(ctx context.Context, cacheClient cache.GlobalCache, userID, roleID uint32) error

CheckUserRoleExist 检查用户角色是否存在

func GetApiIDByPathAndMethod

func GetApiIDByPathAndMethod(cacheClient cache.GlobalCache, path, method string) (uint64, error)

GetApiIDByPathAndMethod 根据api路径和请求方法获取api id

func InitSuperUser

func InitSuperUser(db *gorm.DB) (err error)

InitSuperUser 初始化超级管理员账号

func Migrate

func Migrate(db *gorm.DB, cache cache.GlobalCache) (err error)

func MyDashboardConfigPreloadCharts

func MyDashboardConfigPreloadCharts() basescopes.ScopeMethod

func PromAlarmChatGroupInApp

func PromAlarmChatGroupInApp(apps ...vobj.NotifyApp) basescopes.ScopeMethod

PromAlarmChatGroupInApp 根据app类型查询

func PromAlarmChatGroupPreloadCreateBy

func PromAlarmChatGroupPreloadCreateBy() basescopes.ScopeMethod

PromAlarmChatGroupPreloadCreateBy 预加载创建者

func PromAlarmHistoryClausesOnConflict

func PromAlarmHistoryClausesOnConflict() basescopes.ScopeMethod

PromAlarmHistoryClausesOnConflict 当索引冲突, 直接更新

func PromAlarmHistoryEndTimeRange

func PromAlarmHistoryEndTimeRange(startTime, endTime int64) basescopes.ScopeMethod

PromAlarmHistoryEndTimeRange 根据时间范围查询

func PromAlarmHistoryLikeInfo

func PromAlarmHistoryLikeInfo(keyword string) basescopes.ScopeMethod

PromAlarmHistoryLikeInfo 根据字典名称模糊查询

func PromAlarmHistoryLikeInstance

func PromAlarmHistoryLikeInstance(keyword string) basescopes.ScopeMethod

PromAlarmHistoryLikeInstance 根据字典名称模糊查询

func PromAlarmHistoryPreloadLevel

func PromAlarmHistoryPreloadLevel() basescopes.ScopeMethod

PromAlarmHistoryPreloadLevel 预加载等级

func PromAlarmHistoryPreloadStrategy

func PromAlarmHistoryPreloadStrategy() basescopes.ScopeMethod

PromAlarmHistoryPreloadStrategy 预加载策略

func PromAlarmHistoryStartAtDesc

func PromAlarmHistoryStartAtDesc() basescopes.ScopeMethod

PromAlarmHistoryStartAtDesc 开始时间倒序

func PromAlarmHistoryStartTimeRange

func PromAlarmHistoryStartTimeRange(startTime, endTime int64) basescopes.ScopeMethod

PromAlarmHistoryStartTimeRange 根据时间范围查询

func PromAlarmHistoryWhereDuration

func PromAlarmHistoryWhereDuration(duration int64) basescopes.ScopeMethod

PromAlarmHistoryWhereDuration 根据持续时间查询

func PromAlarmHistoryWhereInLevelID

func PromAlarmHistoryWhereInLevelID(levelIds ...uint32) basescopes.ScopeMethod

PromAlarmHistoryWhereInLevelID 根据等级ID查询

func PromAlarmHistoryWhereInMd5

func PromAlarmHistoryWhereInMd5(md5s ...string) basescopes.ScopeMethod

PromAlarmHistoryWhereInMd5 根据md5查询

func PromAlarmHistoryWhereInStrategyID

func PromAlarmHistoryWhereInStrategyID(strategyIds ...uint32) basescopes.ScopeMethod

PromAlarmHistoryWhereInStrategyID 根据策略ID查询

func PromAlarmHistoryWhereStatus

func PromAlarmHistoryWhereStatus(status vobj.AlarmStatus) basescopes.ScopeMethod

PromAlarmHistoryWhereStatus 根据状态查询

func PromAlarmNotifyMemberClausesOnConflict

func PromAlarmNotifyMemberClausesOnConflict() basescopes.ScopeMethod

PromAlarmNotifyMemberClausesOnConflict 当索引冲突, 直接更新

func PromAlarmNotifyMemberWherePromAlarmNotifyID

func PromAlarmNotifyMemberWherePromAlarmNotifyID(promAlarmNotifyID uint32) basescopes.ScopeMethod

PromAlarmNotifyMemberWherePromAlarmNotifyID .

func PromAlarmNotifyPreloadBeNotifyMembers

func PromAlarmNotifyPreloadBeNotifyMembers(beNotifyMemberIds ...uint32) basescopes.ScopeMethod

PromAlarmNotifyPreloadBeNotifyMembers 预加载被通知成员

func PromAlarmNotifyPreloadChatGroups

func PromAlarmNotifyPreloadChatGroups(chatGroupIds ...uint32) basescopes.ScopeMethod

PromAlarmNotifyPreloadChatGroups 预加载通知组

func PromAlarmRealtimeBetweenEventAt

func PromAlarmRealtimeBetweenEventAt(min, max int64) basescopes.ScopeMethod

PromAlarmRealtimeBetweenEventAt 查询时间范围

func PromAlarmRealtimeClauseOnConflict

func PromAlarmRealtimeClauseOnConflict() clause.Expression

PromAlarmRealtimeClauseOnConflict 冲突处理

func PromAlarmRealtimeEventAtDesc

func PromAlarmRealtimeEventAtDesc() basescopes.ScopeMethod

PromAlarmRealtimeEventAtDesc 事件时间倒序

func PromAlarmRealtimeInHistoryIds

func PromAlarmRealtimeInHistoryIds(historyIds ...uint32) basescopes.ScopeMethod

PromAlarmRealtimeInHistoryIds 查询历史ID列表

func PromAlarmRealtimeInLevelIds

func PromAlarmRealtimeInLevelIds(levelIds ...uint32) basescopes.ScopeMethod

PromAlarmRealtimeInLevelIds 查询级别ID列表

func PromAlarmRealtimeInStrategyIds

func PromAlarmRealtimeInStrategyIds(strategyIds ...uint32) basescopes.ScopeMethod

PromAlarmRealtimeInStrategyIds 查询策略ID列表

func PromAlarmRealtimeLike

func PromAlarmRealtimeLike(keyword string) basescopes.ScopeMethod

PromAlarmRealtimeLike 查询关键字

func PromAlarmRealtimePreloadLevel

func PromAlarmRealtimePreloadLevel() basescopes.ScopeMethod

PromAlarmRealtimePreloadLevel 预加载级别

func PromAlarmRealtimePreloadStrategy

func PromAlarmRealtimePreloadStrategy() basescopes.ScopeMethod

PromAlarmRealtimePreloadStrategy 预加载关联策略

func PromStrategyNotifyTemplateWhereStrategyID

func PromStrategyNotifyTemplateWhereStrategyID(strategyID uint32) basescopes.ScopeMethod

func StrategyAlertLike

func StrategyAlertLike(keyword string) basescopes.ScopeMethod

StrategyAlertLike 策略名称匹配

func StrategyGroupPreloadCategories

func StrategyGroupPreloadCategories(preload bool) basescopes.ScopeMethod

StrategyGroupPreloadCategories 预加载策略组下的分类

func StrategyGroupPreloadPromStrategies

func StrategyGroupPreloadPromStrategies(childPreload ...string) basescopes.ScopeMethod

StrategyGroupPreloadPromStrategies 预加载策略组下的策略

func StrategyGroupWhereCategories

func StrategyGroupWhereCategories(categories ...uint32) basescopes.ScopeMethod

StrategyGroupWhereCategories 策略组下的分类

func StrategyInAlarmPageIds

func StrategyInAlarmPageIds(ids ...uint32) basescopes.ScopeMethod

StrategyInAlarmPageIds in alarm_page_ids

func StrategyInGroupIds

func StrategyInGroupIds(ids ...uint32) basescopes.ScopeMethod

StrategyInGroupIds 策略组ID

func StrategyInStrategyIds

func StrategyInStrategyIds(ids ...uint32) basescopes.ScopeMethod

StrategyInStrategyIds in prom_strategy_id

func StrategyPreloadAlarmPages

func StrategyPreloadAlarmPages() basescopes.ScopeMethod

StrategyPreloadAlarmPages 预加载alarm_pages

func StrategyPreloadAlertLevel

func StrategyPreloadAlertLevel() basescopes.ScopeMethod

StrategyPreloadAlertLevel 预加载alert_level

func StrategyPreloadCategories

func StrategyPreloadCategories() basescopes.ScopeMethod

StrategyPreloadCategories 预加载categories

func StrategyPreloadEndpoint

func StrategyPreloadEndpoint() basescopes.ScopeMethod

StrategyPreloadEndpoint 预加载endpoint

func StrategyPreloadGroupInfo

func StrategyPreloadGroupInfo() basescopes.ScopeMethod

StrategyPreloadGroupInfo 预加载group_info

func StrategyPreloadPromNotifies

func StrategyPreloadPromNotifies(preloadKeys ...string) basescopes.ScopeMethod

StrategyPreloadPromNotifies 预加载prom_notifies

func StrategyPreloadPromNotifyUpgrade

func StrategyPreloadPromNotifyUpgrade() basescopes.ScopeMethod

StrategyPreloadPromNotifyUpgrade 预加载prom_notify_upgrade

func StrategyPreloadTemplate

func StrategyPreloadTemplate() basescopes.ScopeMethod

StrategyPreloadTemplate 预加载template

func SysAPIPreloadRoles

func SysAPIPreloadRoles() basescopes.ScopeMethod

SysAPIPreloadRoles 预加载角色

func SysApiLike

func SysApiLike(keyword string) basescopes.ScopeMethod

SysApiLike like name or path

func SysDictWhereCategory

func SysDictWhereCategory(category vobj.Category) basescopes.ScopeMethod

SysDictWhereCategory 根据字典类型查询

func SysLogPreloadUsers

func SysLogPreloadUsers(userIds ...uint32) basescopes.ScopeMethod

SysLogPreloadUsers 用户

func SysLogWhereModule

func SysLogWhereModule(moduleName vobj.Module, moduleId uint32) basescopes.ScopeMethod

SysLogWhereModule .

func SysRolePreloadApis

func SysRolePreloadApis(apiIds ...uint32) basescopes.ScopeMethod

SysRolePreloadApis 预加载api

func SysRolePreloadUsers

func SysRolePreloadUsers(userIds ...uint32) basescopes.ScopeMethod

SysRolePreloadUsers 预加载用户

func SysUserEqEmail

func SysUserEqEmail(email string) basescopes.ScopeMethod

SysUserEqEmail 等于email

func SysUserEqPhone

func SysUserEqPhone(phone string) basescopes.ScopeMethod

SysUserEqPhone 等于phone

func SysUserLike

func SysUserLike(keyword string) basescopes.ScopeMethod

SysUserLike 模糊查询

func SysUserPreloadAlarmPages

func SysUserPreloadAlarmPages(alarmPageIds ...uint32) basescopes.ScopeMethod

SysUserPreloadAlarmPages 预加载报警页面

func SysUserPreloadRoles

func SysUserPreloadRoles(roleIds ...uint32) basescopes.ScopeMethod

SysUserPreloadRoles 预加载角色

func SysUserUserEqName

func SysUserUserEqName(name string) basescopes.ScopeMethod

SysUserUserEqName 等于name

Types

type ApiSimple

type ApiSimple struct {
	ID     uint   `gorm:"primary_key" json:"id"`
	Path   string `gorm:"column:path;type:varchar(255);not null;uniqueIndex:idx__as__path,priority:1;comment:api路径"`
	Method string `gorm:"column:method;type:varchar(16);not null;comment:请求方法"`
}

func (*ApiSimple) MarshalBinary

func (l *ApiSimple) MarshalBinary() (data []byte, err error)

func (*ApiSimple) UnmarshalBinary

func (l *ApiSimple) UnmarshalBinary(data []byte) error

type BaseModel

type BaseModel struct {
	ID        uint32                `gorm:"primary_key" json:"id"`
	CreatedAt time.Time             `gorm:"column:created_at;type:timestamp;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"-"`
	UpdatedAt time.Time             `gorm:"column:updated_at;type:timestamp;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"-"`
	DeletedAt soft_delete.DeletedAt `gorm:"column:deleted_at;type:bigint;not null;default:0;" json:"-"`
}

type CasbinRule

type CasbinRule struct {
	ID    uint32 `gorm:"primary_key" json:"id"`
	PType string `gorm:"column:ptype;type:varchar(100);not null;index:idx_p_type,priority:1;comment:权限类型"`
	V0    string `gorm:"column:v0;type:varchar(100);not null;index:idx_v0,priority:1;comment:权限参数0"`
	V1    string `gorm:"column:v1;type:varchar(100);not null;index:idx_v1,priority:1;comment:权限参数1"`
	V2    string `gorm:"column:v2;type:varchar(100);not null;index:idx_v2,priority:1;comment:权限参数2"`
	V3    string `gorm:"column:v3;type:varchar(100);not null;index:idx_v3,priority:1;comment:权限参数3"`
	V4    string `gorm:"column:v4;type:varchar(100);not null;index:idx_v4,priority:1;comment:权限参数4"`
	V5    string `gorm:"column:v5;type:varchar(100);not null;index:idx_v5,priority:1;comment:权限参数5"`
}

func (*CasbinRule) TableName

func (*CasbinRule) TableName() string

type DataRoleOp

type DataRoleOp struct {
	BaseModel
	Model   string  `gorm:"column:model;type:varchar(255);not null;comment:模型;index:idx__dr__model"`
	ModelId uint32  `gorm:"column:model_id;type:bigint(20);not null;comment:模型ID;idx__dr__model_id"`
	RoleId  uint32  `gorm:"column:role_id;type:bigint(20);not null;comment:角色ID;idx__dr__role_id"`
	Op      vobj.Op `gorm:"column:op;type:int(11);not null;comment:操作;index:idx__dr__op"`
}

DataRoleOp 数据操作表

func (*DataRoleOp) TableName

func (*DataRoleOp) TableName() string

TableName 表名

type DataUserOp

type DataUserOp struct {
	BaseModel
	Model   string  `gorm:"column:model;type:varchar(255);not null;comment:模型;index:idx__du__model"`
	ModelId uint32  `gorm:"column:model_id;type:bigint(20);not null;comment:模型ID;idx__du__model_id"`
	UserId  uint32  `gorm:"column:user_id;type:bigint(20);not null;comment:用户ID;idx__du__user_id"`
	Op      vobj.Op `gorm:"column:op;type:int(1);not null;comment:操作;index:idx__du__op"`
}

DataUserOp 数据操作表

func (*DataUserOp) TableName

func (*DataUserOp) TableName() string

TableName 表名

type Endpoint

type Endpoint struct {
	BaseModel
	Name      string              `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__ep__name,priority:1;comment:名称"`
	Endpoint  string              `gorm:"column:endpoint;type:varchar(255);not null;uniqueIndex:idx__endpoint,priority:1;comment:地址"`
	Remark    string              `gorm:"column:remark;type:varchar(255);not null;default:这个Endpoint没有说明, 赶紧补充吧;comment:备注"`
	Status    vobj.Status         `gorm:"column:status;type:tinyint;not null;default:1;comment:启用状态: 1启用;2禁用"`
	BasicAuth *strategy.BasicAuth `gorm:"column:basic_auth;type:varchar(255);not null;default:'';comment:基础认证"`
}

func (Endpoint) TableName

func (Endpoint) TableName() string

TableName 表名

type ExternalCustomer

type ExternalCustomer struct {
	BaseModel
	// 外部客户名称
	Name string `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__ec__name,priority:1;comment:外部客户名称"`
	// 外部客户地址
	Address string `gorm:"column:address;type:varchar(255);not null;comment:外部客户地址"`
	// 外部客户联系人
	Contact string `gorm:"column:contact;type:varchar(64);not null;comment:外部客户联系人"`
	// 外部客户联系电话
	Phone string `gorm:"column:phone;type:varchar(64);not null;comment:外部客户联系电话"`
	// 外部客户联系邮箱
	Email string `gorm:"column:email;type:varchar(64);not null;comment:外部客户联系邮箱"`
	// 外部客户备注
	Remark string `gorm:"column:remark;type:varchar(255);not null;comment:外部客户备注"`
	// 外部客户状态
	Status vobj.Status `gorm:"column:status;type:tinyint;not null;default:1;comment:外部客户状态"`
	// 钩子列表
	Hooks []*ExternalCustomerHook `gorm:"foreignKey:CustomerId;comment:外部客户钩子"`
}

func (*ExternalCustomer) GetHooks

func (e *ExternalCustomer) GetHooks() []*ExternalCustomerHook

GetHooks 获取外部客户钩子列表

func (*ExternalCustomer) TableName

func (*ExternalCustomer) TableName() string

type ExternalCustomerHook

type ExternalCustomerHook struct {
	BaseModel
	Hook      string         `gorm:"column:hook;type:varchar(255);not null;comment:钩子地址"`
	HookName  string         `gorm:"column:hook_name;type:varchar(64);not null;comment:钩子名称"`
	NotifyApp vobj.NotifyApp `gorm:"column:notify_app;type:tinyint;not null;default:1;comment:通知方式"`
	Status    vobj.Status    `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	Remark    string         `gorm:"column:remark;type:varchar(255);not null;comment:备注"`

	CustomerId uint32            `gorm:"column:customer_id;type:int unsigned;not null;comment:外部客户ID"`
	Customer   *ExternalCustomer `gorm:"foreignKey:CustomerId;comment:外部客户"`
}

func (*ExternalCustomerHook) GetCustomer

func (e *ExternalCustomerHook) GetCustomer() *ExternalCustomer

GetCustomer 获取外部客户

func (*ExternalCustomerHook) TableName

func (*ExternalCustomerHook) TableName() string

type ExternalNotifyObj

type ExternalNotifyObj struct {
	BaseModel
	// 外部通知对象名称
	Name string `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__eno__name,priority:1;comment:外部通知对象名称"`
	// 外部通知对象说明
	Remark string `gorm:"column:remark;type:varchar(255);not null;comment:外部通知对象说明"`
	// 状态
	Status vobj.Status `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	// 外部客户列表
	CustomerList []*ExternalCustomer `gorm:"many2many:prom_alarm_external_notify_obj_external_customers;comment:外部客户列表"`
	// 外部客户hook列表
	CustomerHookList []*ExternalCustomerHook `gorm:"many2many:prom_alarm_external_notify_obj_external_customer_hooks;comment:外部客户hook列表"`
}

func (*ExternalNotifyObj) GetCustomerHookList

func (e *ExternalNotifyObj) GetCustomerHookList() []*ExternalCustomerHook

GetCustomerHookList 获取外部客户hook列表

func (*ExternalNotifyObj) GetCustomerList

func (e *ExternalNotifyObj) GetCustomerList() []*ExternalCustomer

GetCustomerList 获取外部客户列表

func (*ExternalNotifyObj) TableName

func (*ExternalNotifyObj) TableName() string

type MyChart

type MyChart struct {
	BaseModel
	UserId uint32      `gorm:"column:user_id;type:int unsigned;not null;comment:用户ID"`
	Title  string      `gorm:"column:title;type:varchar(32);not null;comment:标题"`
	Remark string      `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
	Url    string      `gorm:"column:url;type:text;not null;comment:地址"`
	Status vobj.Status `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
}

MyChart 我的仪表盘

func (MyChart) TableName

func (MyChart) TableName() string

type MyDashboardConfig

type MyDashboardConfig struct {
	BaseModel
	Title  string      `gorm:"column:title;type:varchar(32);not null;comment:大盘名称"`
	Remark string      `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
	Color  string      `gorm:"column:color;type:varchar(32);not null;comment:颜色"`
	UserId uint32      `gorm:"column:user_id;type:int unsigned;not null;comment:用户ID"`
	Status vobj.Status `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`

	Charts []*MyChart `gorm:"many2many:my_dashboard_config_charts;comment:图表"`
}

MyDashboardConfig 我的仪表盘配置

func (*MyDashboardConfig) GetCharts

func (l *MyDashboardConfig) GetCharts() []*MyChart

func (*MyDashboardConfig) TableName

func (*MyDashboardConfig) TableName() string

type PromAlarmBeenNotifyChatGroup

type PromAlarmBeenNotifyChatGroup struct {
	BaseModel
	RealtimeAlarmID   uint32              `gorm:"column:realtime_alarm_id;type:int unsigned;not null;index:idx__ncg__realtime_alarm_id,priority:1;comment:告警ID"`
	ChatGroup         *PromAlarmChatGroup `gorm:"foreignKey:ChatGroupId;comment:通知组"`
	ChatGroupId       uint32              `gorm:"column:chat_group_id;type:int unsigned;not null;index:idx__ncg__chat_group_id,priority:1;comment:通知组ID"`
	Status            vobj.Status         `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	Msg               string              `gorm:"column:msg;type:text;not null;comment:通知的消息"`
	PromAlarmNotifyID uint32              `gorm:"column:prom_alarm_notify_id;type:int unsigned;not null;comment:通知ID"`
}

func (*PromAlarmBeenNotifyChatGroup) GetChatGroup

GetChatGroup .

func (*PromAlarmBeenNotifyChatGroup) TableName

func (*PromAlarmBeenNotifyChatGroup) TableName() string

type PromAlarmBeenNotifyMember

type PromAlarmBeenNotifyMember struct {
	BaseModel
	RealtimeAlarmID   uint32           `gorm:"column:realtime_alarm_id;type:int unsigned;not null;index:idx__bnm__realtime_alarm_id,priority:1;comment:告警ID"`
	NotifyType        vobj.NotifyType  `gorm:"column:notify_types;type:tinyint;not null;comment:通知方式"`
	MemberId          uint32           `gorm:"column:member_id;type:int unsigned;not null;comment:通知人员ID"`
	Member            *SysUser         `gorm:"foreignKey:MemberId;comment:成员"`
	Msg               string           `gorm:"column:msg;type:text;not null;comment:通知的消息"`
	Status            vobj.Status      `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	PromAlarmNotifyID uint32           `gorm:"column:prom_alarm_notify_id;type:int unsigned;not null;comment:通知ID"`
	PromAlarmNotify   *PromAlarmNotify `gorm:"foreignKey:PromAlarmNotifyID"`
}

func (*PromAlarmBeenNotifyMember) GetMember

func (p *PromAlarmBeenNotifyMember) GetMember() *SysUser

GetMember .

func (*PromAlarmBeenNotifyMember) GetPromAlarmNotify

func (p *PromAlarmBeenNotifyMember) GetPromAlarmNotify() *PromAlarmNotify

GetPromAlarmNotify .

func (*PromAlarmBeenNotifyMember) TableName

func (*PromAlarmBeenNotifyMember) TableName() string

type PromAlarmChatGroup

type PromAlarmChatGroup struct {
	BaseModel
	Status    vobj.Status    `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	Remark    string         `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
	Name      string         `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__cg__name,priority:1;comment:名称"`
	Hook      string         `gorm:"column:hook;type:varchar(255);not null;comment:钩子地址"`
	NotifyApp vobj.NotifyApp `gorm:"column:notify_app;type:tinyint;not null;default:1;comment:通知方式"`
	HookName  string         `gorm:"column:hook_name;type:varchar(64);not null;comment:钩子名称"`
	Secret    string         `gorm:"column:secret;type:varchar(128);not null;comment:通信密钥"`
	// 创建人ID
	CreateBy   uint32   `gorm:"column:create_by;type:bigint;UNSIGNED;not null;DEFAULT:0;comment:创建人ID"`
	CreateUser *SysUser `gorm:"foreignKey:CreateBy"`
}

PromAlarmChatGroup 告警通知群组机器人信息

func (*PromAlarmChatGroup) TableName

func (*PromAlarmChatGroup) TableName() string

type PromAlarmHistory

type PromAlarmHistory struct {
	BaseModel
	Instance   string           `gorm:"column:instance;type:varchar(64);not null;comment:instance名称;index:idx__h__instance"`
	Status     vobj.AlarmStatus `gorm:"column:status;type:varchar(16);not null;comment:告警消息状态, 报警和恢复"`
	Info       string           `gorm:"column:info;type:json;not null;comment:原始告警消息"`
	StartAt    int64            `gorm:"column:start_at;type:bigint;not null;comment:报警开始时间"`
	EndAt      int64            `gorm:"column:end_at;type:bigint;not null;comment:报警恢复时间"`
	Duration   int64            `gorm:"column:duration;type:bigint;not null;comment:持续时间时间戳, 没有恢复, 时间戳是0"`
	StrategyID uint32           `` /* 126-byte string literal not displayed */
	LevelID    uint32           `gorm:"column:level_id;type:int unsigned;not null;index:idx__h__level_id,priority:1;comment:报警等级ID"`
	Md5        string           `gorm:"column:md5;type:char(32);not null;unique:idx__md5,priority:1;comment:md5"`

	Strategy *PromStrategy `gorm:"foreignKey:StrategyID"`
	Level    *SysDict      `gorm:"foreignKey:LevelID"`

	// 用于回顾告警历史时候的图表查询
	Expr       string `gorm:"column:expr;type:text;not null;comment:prom ql"`
	Datasource string `gorm:"column:datasource;type:varchar(255);not null;comment:数据源;default:''"`
}

PromAlarmHistory 报警历史数据

func (*PromAlarmHistory) GetLevel

func (p *PromAlarmHistory) GetLevel() *SysDict

GetLevel 获取等级

func (*PromAlarmHistory) GetStrategy

func (p *PromAlarmHistory) GetStrategy() *PromStrategy

GetStrategy 获取策略

func (*PromAlarmHistory) TableName

func (*PromAlarmHistory) TableName() string

TableName PromAlarmHistory's table name

type PromAlarmIntervene

type PromAlarmIntervene struct {
	BaseModel
	RealtimeAlarmID uint32   `gorm:"column:realtime_alarm_id;type:int unsigned;not null;index:idx__i__realtime_alarm_id,priority:1;comment:告警ID"`
	UserID          uint32   `gorm:"column:user_id;type:int unsigned;not null;index:idx__i__user_id,priority:1;comment:用户ID"`
	UserInfo        *SysUser `gorm:"foreignKey:UserID"`
	IntervenedAt    int64    `gorm:"column:intervened_at;type:bigint;not null;comment:干预时间"`
	Remark          string   `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
}

PromAlarmIntervene 告警介入信息

func (*PromAlarmIntervene) TableName

func (*PromAlarmIntervene) TableName() string

type PromAlarmNotify

type PromAlarmNotify struct {
	BaseModel
	Name            string                   `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__an__name,priority:1;comment:通知名称"`
	Status          vobj.Status              `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	Remark          string                   `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
	ChatGroups      []*PromAlarmChatGroup    `gorm:"many2many:prom_notify_chat_groups;comment:通知组"`
	BeNotifyMembers []*PromAlarmNotifyMember `gorm:"foreignKey:PromAlarmNotifyID;comment:被通知成员"`
	// 外部体系通知对象(不在用户体系内的人和hook), 多对多
	ExternalNotifyObjs []*ExternalNotifyObj `gorm:"many2many:prom_alarm_notify_external_notify_objs;comment:外部体系通知对象"`
	// 创建人ID
	CreateBy uint32 `gorm:"column:create_by;type:int;not null;comment:创建人ID"`
}

PromAlarmNotify 告警通知对象

func (*PromAlarmNotify) GetBeNotifyMembers

func (p *PromAlarmNotify) GetBeNotifyMembers() []*PromAlarmNotifyMember

GetBeNotifyMembers 获取被通知成员

func (*PromAlarmNotify) GetChatGroups

func (p *PromAlarmNotify) GetChatGroups() []*PromAlarmChatGroup

GetChatGroups 获取通知组

func (*PromAlarmNotify) GetExternalNotifyObjs

func (p *PromAlarmNotify) GetExternalNotifyObjs() []*ExternalNotifyObj

GetExternalNotifyObjs 获取外部体系通知对象

func (*PromAlarmNotify) TableName

func (*PromAlarmNotify) TableName() string

type PromAlarmNotifyMember

type PromAlarmNotifyMember struct {
	BaseModel
	PromAlarmNotifyID uint32          `gorm:"column:prom_alarm_notify_id;type:int unsigned;not null;index:idx__nm__prom_alarm_notify_id,priority:1;comment:通知ID"`
	Status            vobj.Status     `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	NotifyType        vobj.NotifyType `gorm:"column:notify_types;type:tinyint;not null;comment:通知方式"`
	MemberId          uint32          `gorm:"column:member_id;type:int unsigned;not null;index:idx__nm__member_id,priority:1;comment:成员ID"`
	Member            *SysUser        `gorm:"foreignKey:MemberId;comment:成员"`
}

func (*PromAlarmNotifyMember) GetMember

func (p *PromAlarmNotifyMember) GetMember() *SysUser

GetMember 获取成员

func (*PromAlarmNotifyMember) TableName

func (*PromAlarmNotifyMember) TableName() string

type PromAlarmRealtime

type PromAlarmRealtime struct {
	BaseModel
	// StrategyID 发生这条告警的具体策略信息
	StrategyID uint32        `gorm:"column:strategy_id;type:int unsigned;not null;index:idx__ar__strategy_id,priority:1;comment:策略ID"`
	Strategy   *PromStrategy `gorm:"foreignKey:StrategyID"`
	LevelId    uint32        `gorm:"column:level_id;type:int unsigned;not null;index:idx__ar__level_id,priority:1;comment:告警等级ID"`
	Level      *SysDict      `gorm:"foreignKey:LevelId"`
	// Instance 发生这条告警的具体实例信息
	Instance string `gorm:"column:instance;type:varchar(64);not null;index:idx__ar__instance,priority:1;comment:instance名称"`
	Note     string `gorm:"column:note;type:varchar(255);not null;comment:告警内容"`
	// Status 告警状态: 1告警;2恢复
	Status vobj.AlarmStatus `gorm:"column:status;type:tinyint;not null;default:1;comment:告警状态: 1告警;2恢复"`
	// EventAt 告警时间
	EventAt int64 `gorm:"column:event_at;type:bigint;not null;comment:告警时间"`
	// 通知对象, 记录事件发生时候实际的通知人员
	BeenNotifyMembers []*PromAlarmBeenNotifyMember    `gorm:"foreignKey:RealtimeAlarmID;comment:已通知成员"`
	BeenChatGroups    []*PromAlarmBeenNotifyChatGroup `gorm:"foreignKey:RealtimeAlarmID;comment:已通知群组"`
	NotifiedAt        int64                           `gorm:"column:notified_at;type:bigint;not null;default:0;comment:通知时间"`
	// HistoryID 对应的报警历史数据
	HistoryID uint32            `gorm:"column:history_id;type:int unsigned;not null;unique:idx__history_id,priority:1;comment:历史记录ID"`
	History   *PromAlarmHistory `gorm:"foreignKey:HistoryID"`
	// Intervenes 运维介入信息
	AlarmIntervenes []*PromAlarmIntervene `gorm:"foreignKey:RealtimeAlarmID"`
	// AlarmUpgradeInfo 告警升级信息
	AlarmUpgradeInfo *PromAlarmUpgrade `gorm:"foreignKey:RealtimeAlarmID"`
	// AlarmSuppressInfo 告警抑制信息
	AlarmSuppressInfo *PromAlarmSuppress `gorm:"foreignKey:RealtimeAlarmID"`
}

PromAlarmRealtime 实时告警信息

func (*PromAlarmRealtime) GetAlarmIntervenes

func (p *PromAlarmRealtime) GetAlarmIntervenes() []*PromAlarmIntervene

GetAlarmIntervenes 获取运维介入信息

func (*PromAlarmRealtime) GetAlarmSuppressInfo

func (p *PromAlarmRealtime) GetAlarmSuppressInfo() *PromAlarmSuppress

GetAlarmSuppressInfo 获取告警抑制信息

func (*PromAlarmRealtime) GetAlarmUpgradeInfo

func (p *PromAlarmRealtime) GetAlarmUpgradeInfo() *PromAlarmUpgrade

GetAlarmUpgradeInfo 获取告警升级信息

func (*PromAlarmRealtime) GetBeenChatGroups

func (p *PromAlarmRealtime) GetBeenChatGroups() []*PromAlarmBeenNotifyChatGroup

GetBeenChatGroups 获取通知群组

func (*PromAlarmRealtime) GetBeenNotifyMembers

func (p *PromAlarmRealtime) GetBeenNotifyMembers() []*PromAlarmBeenNotifyMember

GetBeenNotifyMembers 获取通知对象

func (*PromAlarmRealtime) GetHistory

func (p *PromAlarmRealtime) GetHistory() *PromAlarmHistory

GetHistory 获取历史记录

func (*PromAlarmRealtime) GetLevel

func (p *PromAlarmRealtime) GetLevel() *SysDict

GetLevel 获取告警等级

func (*PromAlarmRealtime) GetStrategy

func (p *PromAlarmRealtime) GetStrategy() *PromStrategy

GetStrategy 获取策略信息

func (*PromAlarmRealtime) TableName

func (*PromAlarmRealtime) TableName() string

TableName 表名

type PromAlarmSuppress

type PromAlarmSuppress struct {
	BaseModel
	RealtimeAlarmID uint32   `gorm:"column:realtime_alarm_id;type:int unsigned;not null;index:idx__as__realtime_alarm_id,priority:1;comment:告警ID"`
	UserID          uint32   `gorm:"column:user_id;type:int unsigned;not null;index:idx__as__user_id,priority:1;comment:用户ID"`
	UserInfo        *SysUser `gorm:"foreignKey:UserID"`
	SuppressedAt    int64    `gorm:"column:suppressed_at;type:bigint;not null;comment:抑制时间"`
	Remark          string   `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
	Duration        int64    `gorm:"column:duration;type:bigint;not null;comment:抑制时长"`
}

func (*PromAlarmSuppress) TableName

func (*PromAlarmSuppress) TableName() string

type PromAlarmUpgrade

type PromAlarmUpgrade struct {
	BaseModel
	RealtimeAlarmID uint32   `gorm:"column:realtime_alarm_id;type:int unsigned;not null;index:idx__u__realtime_alarm_id,priority:1;comment:告警ID"`
	UserID          uint32   `gorm:"column:user_id;type:int unsigned;not null;index:idx__u__user_id,priority:1;comment:用户ID"`
	UserInfo        *SysUser `gorm:"foreignKey:UserID"`
	UpgradedAt      int64    `gorm:"column:upgraded_at;type:bigint;not null;comment:升级时间"`
	Remark          string   `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
}

PromAlarmUpgrade 告警升级信息

func (*PromAlarmUpgrade) TableName

func (*PromAlarmUpgrade) TableName() string

type PromStrategy

type PromStrategy struct {
	BaseModel
	GroupID      uint32                `` /* 139-byte string literal not displayed */
	Alert        string                `` /* 127-byte string literal not displayed */
	Expr         string                `gorm:"column:expr;type:text;not null;comment:prom ql" json:"expr"`
	For          string                `gorm:"column:for;type:varchar(64);not null;default:10s;comment:持续时间" json:"for"`
	Labels       *strategy.Labels      `gorm:"column:labels;type:json;not null;comment:标签" json:"labels"`
	Annotations  *strategy.Annotations `gorm:"column:annotations;type:json;not null;comment:告警文案" json:"annotations"`
	AlertLevelID uint32                `` /* 133-byte string literal not displayed */
	Status       vobj.Status           `gorm:"column:status;type:tinyint;not null;default:1;comment:启用状态: 1启用;2禁用" json:"status"`
	Remark       string                `gorm:"column:remark;type:varchar(255);not null;comment:描述信息" json:"remark"`

	AlarmPages []*SysDict         `gorm:"many2many:prom_strategy_alarm_pages" json:"-"`
	Categories []*SysDict         `gorm:"many2many:prom_strategy_categories" json:"-"`
	AlertLevel *SysDict           `gorm:"foreignKey:AlertLevelID" json:"-"`
	GroupInfo  *PromStrategyGroup `gorm:"foreignKey:GroupID" json:"-"`

	// 通知对象
	PromNotifies []*PromAlarmNotify `gorm:"many2many:prom_strategy_notifies;comment:通知对象" json:"-"`
	// 告警升级后的通知对象
	PromNotifyUpgrade []*PromAlarmNotify `gorm:"many2many:prom_strategy_notify_upgrades;comment:告警升级后的通知对象" json:"-"`
	// 最大抑制时长(s)
	MaxSuppress string `gorm:"column:max_suppress;type:varchar(255);not null;default:1m;comment:最大抑制时长(s)" json:"max_suppress"`
	// 是否发送告警恢复通知
	SendRecover vobj.IsSendRecover `gorm:"column:send_recover;type:tinyint;not null;default:0;comment:是否发送告警恢复通知" json:"send_recover"`
	// 发送告警时间间隔(s), 默认为for的10倍时间分钟, 用于长时间未消警情况
	SendInterval string `` /* 188-byte string literal not displayed */

	// 数据源
	EndpointID uint32    `gorm:"column:endpoint_id;type:int unsigned;not null;default:0;comment:数据源ID" json:"endpoint_id"`
	Endpoint   *Endpoint `gorm:"foreignKey:EndpointID" json:"-"`

	// 创建人ID
	CreateBy     uint32   `gorm:"column:create_by;type:int;not null;comment:创建人ID"`
	CreateByUser *SysUser `gorm:"foreignKey:CreateBy" json:"-"`

	Templates []*PromStrategyNotifyTemplate `gorm:"foreignKey:StrategyID" json:"-"`
}

PromStrategy mapped from table <prom_strategies>

func (*PromStrategy) GetAlarmPages

func (p *PromStrategy) GetAlarmPages() []*SysDict

GetAlarmPages 获取告警页面

func (*PromStrategy) GetAlertLevel

func (p *PromStrategy) GetAlertLevel() *SysDict

GetAlertLevel 获取告警等级

func (*PromStrategy) GetAnnotations

func (p *PromStrategy) GetAnnotations() *strategy.Annotations

GetAnnotations 获取告警文案

func (*PromStrategy) GetCategories

func (p *PromStrategy) GetCategories() []*SysDict

GetCategories 获取分类

func (*PromStrategy) GetEndpoint

func (p *PromStrategy) GetEndpoint() *Endpoint

GetEndpoint 获取数据源

func (*PromStrategy) GetGroupInfo

func (p *PromStrategy) GetGroupInfo() *PromStrategyGroup

GetGroupInfo 获取所属规则组

func (*PromStrategy) GetLabels

func (p *PromStrategy) GetLabels() *strategy.Labels

GetLabels 获取标签

func (*PromStrategy) GetPromNotifies

func (p *PromStrategy) GetPromNotifies() []*PromAlarmNotify

GetPromNotifies 获取通知对象

func (*PromStrategy) GetPromNotifyUpgrade

func (p *PromStrategy) GetPromNotifyUpgrade() []*PromAlarmNotify

GetPromNotifyUpgrade 获取告警升级后的通知对象

func (*PromStrategy) GetTemplates

func (p *PromStrategy) GetTemplates() []*PromStrategyNotifyTemplate

GetTemplates 获取模板

func (*PromStrategy) TableName

func (*PromStrategy) TableName() string

TableName PromStrategy's table name

func (*PromStrategy) ToMap

func (p *PromStrategy) ToMap() map[string]any

ToMap to map[string]any

type PromStrategyAlarmPage

type PromStrategyAlarmPage struct {
	PromAlarmPageID uint32 `gorm:"column:sys_dict_id;type:int unsigned;not null;index:idx__prom_alarm_page_id,priority:1;comment:报警页面ID"`
	PromStrategyID  uint32 `gorm:"column:prom_strategy_id;type:int unsigned;not null;index:idx__prom_strategy_id,priority:1;comment:报警策略ID"`
}

PromStrategyAlarmPage 报警策略与报警页面关联表

func (PromStrategyAlarmPage) TableName

func (PromStrategyAlarmPage) TableName() string

TableName PromStrategyAlarmPage's table name

type PromStrategyGroup

type PromStrategyGroup struct {
	BaseModel
	Name                string          `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__name,priority:1;comment:规则组名称"`
	StrategyCount       int64           `gorm:"column:strategy_count;type:bigint;not null;default:0;comment:规则数量"`
	EnableStrategyCount int64           `gorm:"column:enable_strategy_count;type:bigint;not null;default:0;comment:启用策略数量"`
	Status              vobj.Status     `gorm:"column:status;type:tinyint;not null;default:1;comment:启用状态1:启用;2禁用"`
	Remark              string          `gorm:"column:remark;type:varchar(255);not null;comment:描述信息"`
	PromStrategies      []*PromStrategy `gorm:"foreignKey:GroupID"`
	Categories          []*SysDict      `gorm:"many2many:prom_group_categories"`
}

PromStrategyGroup 策略组

func (*PromStrategyGroup) GetCategories

func (p *PromStrategyGroup) GetCategories() []*SysDict

GetCategories 获取策略组的分类

func (*PromStrategyGroup) GetPromStrategies

func (p *PromStrategyGroup) GetPromStrategies() []*PromStrategy

GetPromStrategies 获取策略组下的策略

func (*PromStrategyGroup) TableName

func (*PromStrategyGroup) TableName() string

TableName PromStrategyGroup's table name

type PromStrategyNotifyTemplate

type PromStrategyNotifyTemplate struct {
	BaseModel
	StrategyID uint32                  `gorm:"column:strategy_id;type:int unsigned;not null;comment:策略ID"`
	NotifyType vobj.NotifyTemplateType `gorm:"column:notify_type;type:tinyint;not null;comment:通知类型"`
	Content    string                  `gorm:"column:content;type:text;not null;comment:通知内容模板"`
}

func (*PromStrategyNotifyTemplate) TableName

func (*PromStrategyNotifyTemplate) TableName() string

TableName 表名

type SysAPI

type SysAPI struct {
	BaseModel
	Name   string      `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__sa__name,priority:1;comment:api名称"`
	Path   string      `gorm:"column:path;type:varchar(255);not null;uniqueIndex:idx__sa__path,priority:1;comment:api路径"`
	Method string      `gorm:"column:method;type:varchar(16);not null;default:POST;comment:请求方法"`
	Status vobj.Status `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	Remark string      `gorm:"column:remark;type:varchar(255);not null;default:这个API没有说明, 赶紧补充吧;comment:备注"`
	Module vobj.Module `gorm:"column:module;type:int;not null;default:0;comment:模块"`
	Domain vobj.Domain `gorm:"column:domain;type:int;not null;default:0;comment:领域"`
	Roles  []*SysRole  `gorm:"many2many:sys_role_apis;comment:角色api"`
}

SysAPI 系统api

func (*SysAPI) TableName

func (l *SysAPI) TableName() string

TableName 表名

type SysDict

type SysDict struct {
	BaseModel
	Name           string          `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__p__name__category,priority:1;comment:字典名称"`
	Category       vobj.Category   `` /* 142-byte string literal not displayed */
	Color          string          `gorm:"column:color;type:varchar(32);not null;default:#165DFF;comment:字典tag颜色"`
	Status         vobj.Status     `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	Remark         string          `gorm:"column:remark;type:varchar(255);not null;comment:字典备注"`
	PromStrategies []*PromStrategy `gorm:"many2many:prom_strategy_alarm_pages"`
}

SysDict 系统的字典管理

func (*SysDict) TableName

func (*SysDict) TableName() string

TableName SysDict table name

type SysLog

type SysLog struct {
	BaseModel
	Module   vobj.Module `gorm:"column:module;type:int;not null;default:0;comment:模块;index:syslog__m__idx"`
	ModuleId uint32      `gorm:"column:module_id;type:int;not null;default:0;comment:模块id;index:syslog__m__idx"`
	Title    string      `gorm:"column:title;type:varchar(255);not null;comment:日志标题"`
	Content  string      `gorm:"column:content;type:text;not null;comment:日志内容"`
	UserId   uint32      `gorm:"column:user_id;type:int;not null;default:0;comment:用户id"`
	Action   vobj.Action `gorm:"column:action;type:int;not null;default:0;comment:操作"`

	User *SysUser `gorm:"foreignKey:UserId;references:ID;comment:用户"`
}

func (*SysLog) GetUser

func (l *SysLog) GetUser() *SysUser

GetUser .

func (*SysLog) TableName

func (l *SysLog) TableName() string

type SysRole

type SysRole struct {
	BaseModel
	Remark string      `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
	Name   string      `gorm:"column:name;type:varchar(64);not null;uniqueIndex:idx__sr__name,priority:1;comment:角色名称"`
	Status vobj.Status `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	Users  []*SysUser  `gorm:"many2many:sys_user_roles;comment:用户角色"`
	Apis   []*SysAPI   `gorm:"many2many:sys_role_apis;comment:角色api"`
}

SysRole 角色表

func (*SysRole) GetApis

func (r *SysRole) GetApis() []*SysAPI

GetApis 获取api

func (*SysRole) GetUsers

func (r *SysRole) GetUsers() []*SysUser

GetUsers 获取用户

func (*SysRole) TableName

func (*SysRole) TableName() string

TableName 表名

type SysUser

type SysUser struct {
	BaseModel
	Username   string      `gorm:"column:username;type:varchar(64);not null;uniqueIndex:idx__su__username,priority:1;comment:用户名"`
	Nickname   string      `gorm:"column:nickname;type:varchar(64);not null;comment:昵称"`
	Password   string      `gorm:"column:password;type:varchar(255);not null;comment:密码"`
	Email      string      `gorm:"column:email;type:varchar(64);not null;uniqueIndex:idx__su__email,priority:1;comment:邮箱"`
	Phone      string      `gorm:"column:phone;type:varchar(64);not null;uniqueIndex:idx__su__phone,priority:1;comment:手机号"`
	Status     vobj.Status `gorm:"column:status;type:tinyint;not null;default:1;comment:状态"`
	Remark     string      `gorm:"column:remark;type:varchar(255);not null;comment:备注"`
	Avatar     string      `gorm:"column:avatar;type:varchar(255);not null;comment:头像"`
	Salt       string      `gorm:"column:salt;type:varchar(16);not null;comment:盐"`
	Gender     vobj.Gender `gorm:"column:gender;type:tinyint;not null;default:0;comment:性别"`
	Roles      []*SysRole  `gorm:"many2many:sys_user_roles;comment:用户角色"`
	AlarmPages []*SysDict  `gorm:"many2many:sys_user_alarm_pages;comment:用户页面"`
}

SysUser 用户表

func (*SysUser) GetAlarmPages

func (u *SysUser) GetAlarmPages() []*SysDict

GetAlarmPages 获取页面列表

func (*SysUser) GetRoles

func (u *SysUser) GetRoles() []*SysRole

GetRoles 获取角色列表

func (*SysUser) TableName

func (*SysUser) TableName() string

TableName 表名

type UserRole

type UserRole struct {
	UserID uint32 `json:"sys_user_id" gorm:"column:sys_user_id"`
	RoleID uint32 `json:"sys_role_id" gorm:"column:sys_role_id"`
}

func (*UserRole) TableName

func (*UserRole) TableName() string

type UserRoles

type UserRoles struct {
	UserID uint32   `json:"user_id"`
	Roles  []uint32 `json:"roles"`
}

func (*UserRoles) Bytes

func (l *UserRoles) Bytes() []byte

Bytes binary marshaling

func (*UserRoles) MarshalBinary

func (l *UserRoles) MarshalBinary() (data []byte, err error)

func (*UserRoles) UnmarshalBinary

func (l *UserRoles) UnmarshalBinary(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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