db

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuppressTypePause = "pause"
	SuppressTypeStop  = "stop"
)
View Source
const (
	TableAlertRecord                  = "sp_alert_record"
	TableCustomizeAlert               = "sp_customize_alert"
	TableCustomizeAlertRule           = "sp_customize_alert_rule"
	TableCustomizeAlertNotifyTemplate = "sp_customize_alert_notify_template"
	TableAlertRules                   = "sp_alert_rules"
	TableAlertNotify                  = "sp_alert_notify"
	TableAlertNotifyTemplate          = "sp_alert_notify_template"
	TableAlertExpression              = "sp_alert_expression"
	TableMetricExpression             = "sp_metric_expression"
	TableAlert                        = "sp_alert"
	TableAlertEvent                   = "sp_alert_event"
	TableAlertEventSuppress           = "sp_alert_event_suppress"
)

tables name

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID           uint64          `gorm:"column:id"`
	Name         string          `gorm:"column:name"`
	AlertScope   string          `gorm:"column:alert_scope"`
	AlertScopeID string          `gorm:"column:alert_scope_id"`
	Attributes   jsonmap.JSONMap `gorm:"column:attributes"`
	Enable       bool            `gorm:"column:enable"`
	CreatorID    string          `gorm:"column:creator_id"`
	Created      time.Time       `gorm:"column:created"`
	Updated      time.Time       `gorm:"column:updated"`
}

Alert .

func (Alert) TableName

func (Alert) TableName() string

TableName 。

type AlertDB

type AlertDB struct {
	*gorm.DB
}

AlertDB .

func (*AlertDB) CountByScopeAndScopeID

func (db *AlertDB) CountByScopeAndScopeID(scope, scopeID, name string) (int, error)

CountByScopeAndScopeID .

func (*AlertDB) DeleteByID

func (db *AlertDB) DeleteByID(id uint64) error

DeleteByID .

func (*AlertDB) GetAllAvailableAlertIds

func (db *AlertDB) GetAllAvailableAlertIds() ([]uint64, error)

func (*AlertDB) GetAvailableAlertIdByScope

func (db *AlertDB) GetAvailableAlertIdByScope(scope, scopeID string) ([]uint64, error)

func (*AlertDB) GetByID

func (db *AlertDB) GetByID(id uint64) (*Alert, error)

GetByID .

func (*AlertDB) GetByScopeAndScopeIDAndId

func (db *AlertDB) GetByScopeAndScopeIDAndId(scope, scopeID string, id uint64) (*Alert, error)

GetByScopeAndScopeIDAndId .

func (*AlertDB) GetByScopeAndScopeIDAndName

func (db *AlertDB) GetByScopeAndScopeIDAndName(scope, scopeID, name string) (*Alert, error)

GetByScopeAndScopeIDAndName .

func (*AlertDB) Insert

func (db *AlertDB) Insert(alert *Alert) error

Insert .

func (*AlertDB) QueryByScopeAndScopeID

func (db *AlertDB) QueryByScopeAndScopeID(scope, scopeID string, pageNo, pageSize uint64, name string) ([]*Alert, error)

QueryByScopeAndScopeID .

func (*AlertDB) Update

func (db *AlertDB) Update(alert *Alert) error

Update .

func (*AlertDB) UpdateEnable

func (db *AlertDB) UpdateEnable(id uint64, enable bool) error

UpdateEnable .

type AlertEvent

type AlertEvent struct {
	Id               string    `gorm:"column:id;primary_key"`
	Name             string    `gorm:"column:name"`
	OrgID            int64     `gorm:"column:org_id"`
	AlertGroupID     string    `gorm:"column:alert_group_id"`
	AlertGroup       string    `gorm:"column:alert_group"`
	Scope            string    `gorm:"column:scope"`
	ScopeID          string    `gorm:"column:scope_id"`
	AlertID          uint64    `gorm:"column:alert_id"`
	AlertName        string    `gorm:"column:alert_name"`
	AlertType        string    `gorm:"column:alert_type"`
	AlertIndex       string    `gorm:"column:alert_index"`
	AlertLevel       string    `gorm:"column:alert_level"`
	AlertSource      string    `gorm:"column:alert_source"`
	AlertSubject     string    `gorm:"column:alert_subject"`
	AlertState       string    `gorm:"column:alert_state"`
	RuleID           uint64    `gorm:"column:rule_id"`
	RuleName         string    `gorm:"column:rule_name"`
	ExpressionID     uint64    `gorm:"column:expression_id"`
	LastTriggerTime  time.Time `gorm:"column:last_trigger_time"`
	FirstTriggerTime time.Time `gorm:"column:first_trigger_time"`
}

func (AlertEvent) TableName

func (AlertEvent) TableName() string

TableName .

type AlertEventDB

type AlertEventDB struct {
	*gorm.DB
}

AlertEventDB .

func (*AlertEventDB) CountByCondition

func (db *AlertEventDB) CountByCondition(scope, scopeId string, condition *AlertEventQueryCondition) (int64, error)

CountByCondition .

func (*AlertEventDB) CountUnRecoverEvents

func (db *AlertEventDB) CountUnRecoverEvents(scope, scopeId string, inAlertIds []uint64) (int64, error)

func (*AlertEventDB) CountUnRecoverEventsGroupByScope

func (db *AlertEventDB) CountUnRecoverEventsGroupByScope() ([]*AlertEventScopeCountResult, error)

func (*AlertEventDB) CreateAlertEvent

func (db *AlertEventDB) CreateAlertEvent(data *AlertEvent) error

func (*AlertEventDB) GetByAlertGroupID

func (db *AlertEventDB) GetByAlertGroupID(groupID string) (*AlertEvent, error)

GetByAlertGroupID .

func (*AlertEventDB) GetById

func (db *AlertEventDB) GetById(id string) (*AlertEvent, error)

func (*AlertEventDB) QueryByCondition

func (db *AlertEventDB) QueryByCondition(scope, scopeId string, condition *AlertEventQueryCondition, sorts []*AlertEventSort, pageNo, pageSize int64) ([]*AlertEvent, error)

QueryByCondition .

func (*AlertEventDB) UpdateAlertEvent

func (db *AlertEventDB) UpdateAlertEvent(id string, fields map[string]interface{}) error

type AlertEventQueryCondition

type AlertEventQueryCondition struct {
	Name                 string
	Ids                  []string
	AlertLevels          []string
	AlertIds             []uint64
	AlertStates          []string
	SuppressedIds        []string
	AlertSources         []string
	LastTriggerTimeMsMin uint64
	LastTriggerTimeMsMax uint64
}

type AlertEventScopeCountResult

type AlertEventScopeCountResult struct {
	OrgID   int64
	Scope   string
	ScopeId string
	AlertId uint64
	Count   int64
}

type AlertEventSort

type AlertEventSort struct {
	SortField  string
	Descending bool
}

type AlertEventSuppress

type AlertEventSuppress struct {
	Id           string    `gorm:"column:id;primary_key"`
	OrgID        int64     `gorm:"column:org_id"`
	Scope        string    `gorm:"column:scope"`
	ScopeID      string    `gorm:"column:scope_id"`
	AlertEventID string    `gorm:"column:alert_event_id"`
	SuppressType string    `gorm:"column:suppress_type"`
	ExpireTime   time.Time `gorm:"column:expire_time"`
	Enabled      bool      `gorm:"column:enabled"`
}

func (AlertEventSuppress) TableName

func (AlertEventSuppress) TableName() string

type AlertEventSuppressDB

type AlertEventSuppressDB struct {
	*gorm.DB
}

AlertEventSuppressDB .

func (*AlertEventSuppressDB) CancelSuppress

func (db *AlertEventSuppressDB) CancelSuppress(eventId string) (bool, error)

func (*AlertEventSuppressDB) QueryByCondition

func (db *AlertEventSuppressDB) QueryByCondition(scope, scopeId string, condition *AlertEventSuppressQueryCondition) ([]*AlertEventSuppress, error)

func (*AlertEventSuppressDB) Suppress

func (db *AlertEventSuppressDB) Suppress(orgId int64, scope, scopeId string, eventId string, suppressType string, expireTime time.Time) (bool, error)

type AlertEventSuppressQueryCondition

type AlertEventSuppressQueryCondition struct {
	SuppressTypes []string
	EventIds      []string
	Enabled       *bool
}

type AlertExpression

type AlertExpression struct {
	ID         uint64          `gorm:"column:id" json:"id"`
	AlertID    uint64          `gorm:"column:alert_id" json:"alert_id"`
	Attributes jsonmap.JSONMap `gorm:"column:attributes" json:"attributes"`
	Expression jsonmap.JSONMap `gorm:"column:expression" json:"expression"`
	Version    string          `gorm:"column:version" json:"version"`
	Enable     bool            `gorm:"column:enable" json:"enable"`
	Created    time.Time       `gorm:"column:created" json:"created"`
	Updated    time.Time       `gorm:"column:updated" json:"updated"`
}

AlertExpression .

func (AlertExpression) TableName

func (AlertExpression) TableName() string

TableName 。

type AlertExpressionDB

type AlertExpressionDB struct {
	*gorm.DB
}

AlertExpressionDB .

func (*AlertExpressionDB) DeleteByAlertID

func (db *AlertExpressionDB) DeleteByAlertID(alertID uint64) error

DeleteByAlertID .

func (*AlertExpressionDB) DeleteByIDs

func (db *AlertExpressionDB) DeleteByIDs(ids []uint64) error

DeleteByIDs .

func (*AlertExpressionDB) GetAllAlertExpression

func (db *AlertExpressionDB) GetAllAlertExpression(pageNo, pageSize int64) ([]*AlertExpression, int64, error)

GetAllAlertExpression

func (*AlertExpressionDB) Insert

func (db *AlertExpressionDB) Insert(expression *AlertExpression) error

Insert .

func (*AlertExpressionDB) QueryByAlertIDs

func (db *AlertExpressionDB) QueryByAlertIDs(alertIDs []uint64) ([]*AlertExpression, error)

QueryByAlertIDs .

func (*AlertExpressionDB) QueryByIDs

func (db *AlertExpressionDB) QueryByIDs(ids []uint64) ([]*AlertExpression, error)

QueryByIDs .

func (*AlertExpressionDB) QueryRuleCount

func (db *AlertExpressionDB) QueryRuleCount(alertIds []uint64) (map[uint64]int64, error)

QueryRuleCount .

func (*AlertExpressionDB) Update

func (db *AlertExpressionDB) Update(expression *AlertExpression) error

Update .

func (*AlertExpressionDB) UpdateEnableByAlertID

func (db *AlertExpressionDB) UpdateEnableByAlertID(alertID uint64, enable bool) error

UpdateEnableByAlertID .

type AlertNotify

type AlertNotify struct {
	ID             uint64          `gorm:"column:id" json:"id"`
	AlertID        uint64          `gorm:"column:alert_id" json:"alert_id"`
	NotifyKey      string          `gorm:"column:notify_key" json:"notify_key"`
	NotifyTarget   jsonmap.JSONMap `gorm:"column:notify_target" json:"notify_target"`
	NotifyTargetID string          `gorm:"column:notify_target_id" json:"notify_target_id"`
	Silence        int64           `gorm:"column:silence" json:"silence"`
	SilencePolicy  string          `gorm:"column:silence_policy" json:"silence_policy"`
	Enable         bool            `gorm:"column:enable" json:"enable"`
	Created        time.Time       `gorm:"column:created" json:"created"`
	Updated        time.Time       `gorm:"column:updated" json:"updated"`
}

AlertNotify .

func (AlertNotify) TableName

func (AlertNotify) TableName() string

TableName .

type AlertNotifyDB

type AlertNotifyDB struct {
	*gorm.DB
}

AlertNotifyDB .

func (*AlertNotifyDB) DeleteByAlertID

func (db *AlertNotifyDB) DeleteByAlertID(alertID uint64) error

DeleteByAlertID .

func (*AlertNotifyDB) DeleteByIDs

func (db *AlertNotifyDB) DeleteByIDs(ids []uint64) error

DeleteByIDs .

func (*AlertNotifyDB) Insert

func (db *AlertNotifyDB) Insert(notify *AlertNotify) error

Insert .

func (*AlertNotifyDB) QueryAlertNotify

func (db *AlertNotifyDB) QueryAlertNotify(pageNo, pageSize int64) ([]*AlertNotify, int64, error)

func (*AlertNotifyDB) QueryByAlertIDs

func (db *AlertNotifyDB) QueryByAlertIDs(alertIDs []uint64) ([]*AlertNotify, error)

QueryByAlertIDs .

func (*AlertNotifyDB) Update

func (db *AlertNotifyDB) Update(notify *AlertNotify) error

Update .

func (*AlertNotifyDB) UpdateEnableByAlertID

func (db *AlertNotifyDB) UpdateEnableByAlertID(alertID uint64, enable bool) error

UpdateEnableByAlertID .

type AlertNotifyTemplate

type AlertNotifyTemplate struct {
	ID         uint64          `gorm:"column:id"`
	Name       string          `gorm:"column:name"`
	AlertType  string          `gorm:"column:alert_type"`
	AlertIndex string          `gorm:"column:alert_index"`
	Target     string          `gorm:"column:target"`
	Trigger    string          `gorm:"column:trigger"`
	Title      string          `gorm:"column:title"`
	Template   string          `gorm:"column:template"`
	Formats    jsonmap.JSONMap `gorm:"column:formats"`
	Version    string          `gorm:"column:version"`
	Enable     bool            `gorm:"column:enable"`
	CreateTime time.Time       `gorm:"column:create_time"`
	UpdateTime time.Time       `gorm:"column:update_time"`
}

AlertNotifyTemplate .

func (AlertNotifyTemplate) TableName

func (AlertNotifyTemplate) TableName() string

TableName 。

type AlertNotifyTemplateDB

type AlertNotifyTemplateDB struct {
	*gorm.DB
}

AlertNotifyTemplateDB .

func (*AlertNotifyTemplateDB) QueryEnabledByTypesAndIndexes

func (db *AlertNotifyTemplateDB) QueryEnabledByTypesAndIndexes(
	types, indexes []string) ([]*AlertNotifyTemplate, error)

QueryEnabledByTypesAndIndexes .

type AlertRecord

type AlertRecord struct {
	GroupID       string    `gorm:"column:group_id;primary_key"`
	Scope         string    `gorm:"column:scope"`
	ScopeKey      string    `gorm:"column:scope_key"`
	AlertGroup    string    `gorm:"column:alert_group"`
	Title         string    `gorm:"column:title"`
	AlertState    string    `gorm:"column:alert_state"`
	AlertType     string    `gorm:"column:alert_type"`
	AlertIndex    string    `gorm:"column:alert_index"`
	ExpressionKey string    `gorm:"column:expression_key"`
	AlertID       uint64    `gorm:"column:alert_id"`
	AlertName     string    `gorm:"column:alert_name"`
	RuleID        uint64    `gorm:"column:rule_id"`
	IssueID       uint64    `gorm:"column:issue_id"`
	HandleState   string    `gorm:"column:handle_state"`
	HandlerID     string    `gorm:"column:handler_id"`
	AlertTime     time.Time `gorm:"column:alert_time"`
	HandleTime    time.Time `gorm:"column:handle_time;default:null"`
	CreateTime    time.Time `gorm:"column:create_time"`
	UpdateTime    time.Time `gorm:"column:update_time"`
}

func (AlertRecord) TableName

func (AlertRecord) TableName() string

TableName .

type AlertRecordDB

type AlertRecordDB struct {
	*gorm.DB
}

AlertRecordDB .

func (*AlertRecordDB) CountByCondition

func (db *AlertRecordDB) CountByCondition(scope, scopeKey string,
	alertGroups, alertStates, alertTypes, handleStates, handlerIDs []string) (int, error)

CountByCondition .

func (*AlertRecordDB) GetByGroupID

func (db *AlertRecordDB) GetByGroupID(groupID string) (*AlertRecord, error)

GetByGroupID .

func (*AlertRecordDB) QueryByCondition

func (db *AlertRecordDB) QueryByCondition(scope, scopeKey string,
	alertGroups, alertStates, alertTypes, handleStates, handlerIDs []string, pageNo, pageSize uint) (
	[]*AlertRecord, error)

QueryByCondition .

func (*AlertRecordDB) UpdateHandle

func (db *AlertRecordDB) UpdateHandle(groupID string, issueID uint64, handlerID string, handleState string) error

UpdateHandle .

type AlertRule

type AlertRule struct {
	ID         uint64          `gorm:"column:id"`
	Name       string          `gorm:"column:name"`
	AlertScope string          `gorm:"column:alert_scope"`
	AlertType  string          `gorm:"column:alert_type"`
	AlertIndex string          `gorm:"column:alert_index"`
	Template   jsonmap.JSONMap `gorm:"column:template"`
	Attributes jsonmap.JSONMap `gorm:"column:attributes"`
	Version    string          `gorm:"column:version"`
	Enable     bool            `gorm:"column:enable"`
	CreateTime time.Time       `gorm:"column:create_time"`
	UpdateTime time.Time       `gorm:"column:update_time"`
}

AlertRule .

func (AlertRule) TableName

func (AlertRule) TableName() string

TableName .

type AlertRuleCount

type AlertRuleCount struct {
	AlertId uint64 `gorm:"alert_id"`
	Count   int64  `gorm:"count"`
}

AlertRuleCount .

type AlertRuleDB

type AlertRuleDB struct {
	*gorm.DB
}

AlertRuleDB .

func (*AlertRuleDB) DistinctAlertTypeByScope

func (db *AlertRuleDB) DistinctAlertTypeByScope(scope string) ([]string, error)

DistinctAlertTypeByScope .

func (*AlertRuleDB) QueryByIndexes

func (db *AlertRuleDB) QueryByIndexes(indexes []string) ([]*AlertRule, error)

QueryByIndexes .

func (*AlertRuleDB) QueryEnabledByScope

func (db *AlertRuleDB) QueryEnabledByScope(scope string) ([]*AlertRule, error)

QueryEnabledByScope .

func (*AlertRuleDB) QueryEnabledByScopeAndIndices

func (db *AlertRuleDB) QueryEnabledByScopeAndIndices(scope string, indices []string) ([]*AlertRule, error)

QueryEnabledByScopeAndIndices .

type CustomizeAlert

type CustomizeAlert struct {
	ID           uint64          `gorm:"column:id"`
	Name         string          `gorm:"column:name"`
	AlertType    string          `gorm:"column:alert_type"`
	AlertScope   string          `gorm:"column:alert_scope"`
	AlertScopeID string          `gorm:"column:alert_scope_id"`
	Attributes   jsonmap.JSONMap `gorm:"column:attributes"`
	Enable       bool            `gorm:"column:enable"`
	CreatorID    string          `gorm:"column:creator_id"`
	CreateTime   time.Time       `gorm:"column:create_time"`
	UpdateTime   time.Time       `gorm:"column:update_time"`
}

CustomizeAlert .

func (CustomizeAlert) TableName

func (CustomizeAlert) TableName() string

TableName .

type CustomizeAlertDB

type CustomizeAlertDB struct {
	*gorm.DB
}

CustomizeAlertDB .

func (*CustomizeAlertDB) CountByScopeAndScopeID

func (db *CustomizeAlertDB) CountByScopeAndScopeID(scope, scopeID, name string) (int, error)

CountByScopeAndScopeID .

func (*CustomizeAlertDB) DeleteByID

func (db *CustomizeAlertDB) DeleteByID(id uint64) error

DeleteByID .

func (*CustomizeAlertDB) GetByID

func (db *CustomizeAlertDB) GetByID(id uint64) (*CustomizeAlert, error)

GetByID .

func (*CustomizeAlertDB) GetByScopeAndScopeIDAndName

func (db *CustomizeAlertDB) GetByScopeAndScopeIDAndName(scope, scopeID, name string) (*CustomizeAlert, error)

GetByScopeAndScopeIDAndName .

func (*CustomizeAlertDB) Insert

func (db *CustomizeAlertDB) Insert(alert *CustomizeAlert) error

Insert .

func (*CustomizeAlertDB) QueryByScopeAndScopeID

func (db *CustomizeAlertDB) QueryByScopeAndScopeID(scope, scopeID string, pageNo, pageSize int, name string) ([]*CustomizeAlert, error)

QueryByScopeAndScopeID .

func (*CustomizeAlertDB) Update

func (db *CustomizeAlertDB) Update(alert *CustomizeAlert) error

Update .

func (*CustomizeAlertDB) UpdateEnable

func (db *CustomizeAlertDB) UpdateEnable(id uint64, enable bool) error

UpdateEnable .

type CustomizeAlertNotifyTemplate

type CustomizeAlertNotifyTemplate struct {
	ID               uint64          `gorm:"column:id" json:"id"`
	Name             string          `gorm:"column:name" json:"name"`
	CustomizeAlertID uint64          `gorm:"column:customize_alert_id" json:"customize_alert_id"`
	AlertType        string          `gorm:"column:alert_type" json:"alert_type"`
	AlertIndex       string          `gorm:"column:alert_index" json:"alert_index"`
	Target           string          `gorm:"column:target" json:"target"`
	Trigger          string          `gorm:"column:trigger" json:"trigger"`
	Title            string          `gorm:"column:title" json:"title"`
	Template         string          `gorm:"column:template" json:"template"`
	Formats          jsonmap.JSONMap `gorm:"column:formats" json:"formats"`
	Version          string          `gorm:"column:version" json:"version"`
	Enable           bool            `gorm:"column:Enable" json:"enable"`
	CreateTime       time.Time       `gorm:"column:create_time" json:"create_time"`
	UpdateTime       time.Time       `gorm:"column:update_time" json:"update_time"`
}

CustomizeAlertNotifyTemplate .

func (CustomizeAlertNotifyTemplate) TableName

TableName .

type CustomizeAlertNotifyTemplateDB

type CustomizeAlertNotifyTemplateDB struct {
	*gorm.DB
}

CustomizeAlertNotifyTemplateDB .

func (*CustomizeAlertNotifyTemplateDB) DeleteByAlertID

func (db *CustomizeAlertNotifyTemplateDB) DeleteByAlertID(alertID uint64) error

DeleteByAlertID .

func (*CustomizeAlertNotifyTemplateDB) DeleteByIDs

func (db *CustomizeAlertNotifyTemplateDB) DeleteByIDs(ids []uint64) error

DeleteByIDs .

func (*CustomizeAlertNotifyTemplateDB) Insert

Insert .

func (*CustomizeAlertNotifyTemplateDB) QueryByAlertIDs

func (db *CustomizeAlertNotifyTemplateDB) QueryByAlertIDs(alertIDs []uint64) ([]*CustomizeAlertNotifyTemplate, error)

QueryByAlertIDs .

func (*CustomizeAlertNotifyTemplateDB) QueryCustomizeAlertTemplate

func (db *CustomizeAlertNotifyTemplateDB) QueryCustomizeAlertTemplate() ([]*CustomizeAlertNotifyTemplate, error)

func (*CustomizeAlertNotifyTemplateDB) QueryEnabledByTypesAndIndexes

func (db *CustomizeAlertNotifyTemplateDB) QueryEnabledByTypesAndIndexes(
	types, indexes []string) ([]*CustomizeAlertNotifyTemplate, error)

QueryEnabledByTypesAndIndexes .

func (*CustomizeAlertNotifyTemplateDB) Update

Update .

func (*CustomizeAlertNotifyTemplateDB) UpdateEnableByAlertID

func (db *CustomizeAlertNotifyTemplateDB) UpdateEnableByAlertID(alertID uint64, enable bool) error

UpdateEnableByAlertID .

type CustomizeAlertRule

type CustomizeAlertRule struct {
	ID               uint64          `gorm:"column:id"`
	Name             string          `gorm:"column:name"`
	CustomizeAlertID uint64          `gorm:"column:customize_alert_id"`
	AlertType        string          `gorm:"column:alert_type"`
	AlertIndex       string          `gorm:"column:alert_index"`
	AlertScope       string          `gorm:"column:alert_scope"`
	AlertScopeID     string          `gorm:"column:alert_scope_id"`
	Template         jsonmap.JSONMap `gorm:"column:template"`
	Attributes       jsonmap.JSONMap `gorm:"column:attributes"`
	Enable           bool            `gorm:"column:enable"`
	CreateTime       time.Time       `gorm:"column:create_time"`
	UpdateTime       time.Time       `gorm:"column:update_time"`
}

CustomizeAlertRule .

func (CustomizeAlertRule) TableName

func (CustomizeAlertRule) TableName() string

TableName .

type CustomizeAlertRuleDB

type CustomizeAlertRuleDB struct {
	*gorm.DB
}

CustomizeAlertRuleDB .

func (*CustomizeAlertRuleDB) DeleteByAlertID

func (db *CustomizeAlertRuleDB) DeleteByAlertID(alertID uint64) error

DeleteByAlertID .

func (*CustomizeAlertRuleDB) DeleteByIDs

func (db *CustomizeAlertRuleDB) DeleteByIDs(ids []uint64) error

DeleteByIDs .

func (*CustomizeAlertRuleDB) Insert

func (db *CustomizeAlertRuleDB) Insert(rule *CustomizeAlertRule) error

Insert .

func (*CustomizeAlertRuleDB) QueryByAlertIDs

func (db *CustomizeAlertRuleDB) QueryByAlertIDs(alertIDs []uint64) ([]*CustomizeAlertRule, error)

QueryByAlertIDs .

func (*CustomizeAlertRuleDB) QueryEnabledByScope

func (db *CustomizeAlertRuleDB) QueryEnabledByScope(scope, scopeID string) ([]*CustomizeAlertRule, error)

QueryEnabledByScope .

func (*CustomizeAlertRuleDB) QueryEnabledByScopeAndIndices

func (db *CustomizeAlertRuleDB) QueryEnabledByScopeAndIndices(
	scope, scopeID string, indices []string) ([]*CustomizeAlertRule, error)

QueryEnabledByScopeAndIndices .

func (*CustomizeAlertRuleDB) Update

func (db *CustomizeAlertRuleDB) Update(rule *CustomizeAlertRule) error

Update .

func (*CustomizeAlertRuleDB) UpdateEnableByAlertID

func (db *CustomizeAlertRuleDB) UpdateEnableByAlertID(alertID uint64, enable bool) error

UpdateEnableByAlertID .

type DB

type DB struct {
	*gorm.DB
	CustomizeAlert               CustomizeAlertDB
	CustomizeAlertRule           CustomizeAlertRuleDB
	CustomizeAlertNotifyTemplate CustomizeAlertNotifyTemplateDB
	Alert                        AlertDB
	AlertExpression              AlertExpressionDB
	AlertNotify                  AlertNotifyDB
	AlertNotifyTemplate          AlertNotifyTemplateDB
	AlertRule                    AlertRuleDB
	AlertRecord                  AlertRecordDB
	AlertEventDB                 AlertEventDB
	AlertEventSuppressDB         AlertEventSuppressDB
}

DB .

func New

func New(db *gorm.DB) *DB

New .

func (*DB) Begin

func (db *DB) Begin() *DB

Begin .

type MetricExpression

type MetricExpression struct {
	ID         uint64          `gorm:"column:id" json:"id"`
	Attributes jsonmap.JSONMap `gorm:"column:attributes" json:"attributes"`
	Expression jsonmap.JSONMap `gorm:"column:expression" json:"expression"`
	Version    string          `gorm:"column:version" json:"version"`
	Enable     bool            `gorm:"column:enable" json:"enable"`
	Created    time.Time       `gorm:"column:created" json:"created"`
	Updated    time.Time       `gorm:"column:updated" json:"updated"`
}

func (MetricExpression) TableName

func (MetricExpression) TableName() string

type MetricExpressionDB

type MetricExpressionDB struct {
	*gorm.DB
}

MetricExpression

func (*MetricExpressionDB) GetAllMetricExpression

func (db *MetricExpressionDB) GetAllMetricExpression(pageNo, pageSize int64) ([]*MetricExpression, error)

Jump to

Keyboard shortcuts

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