db

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

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"
	TableAlert                        = "sp_alert"
)

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"`
	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 string) (int, error)

CountByScopeAndScopeID .

func (*AlertDB) DeleteByID

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

DeleteByID .

func (*AlertDB) GetByID

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

GetByID .

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) ([]*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 AlertExpression

type AlertExpression struct {
	ID         uint64          `gorm:"column:id"`
	AlertID    uint64          `gorm:"column:alert_id"`
	Attributes jsonmap.JSONMap `gorm:"column:attributes"`
	Expression jsonmap.JSONMap `gorm:"column:expression"`
	Version    string          `gorm:"column:version"`
	Enable     bool            `gorm:"column:enable"`
	Created    time.Time       `gorm:"column:created"`
	Updated    time.Time       `gorm:"column: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) 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) 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"`
	AlertID        uint64          `gorm:"column:alert_id"`
	NotifyKey      string          `gorm:"column:notify_key"`
	NotifyTarget   jsonmap.JSONMap `gorm:"column:notify_target"`
	NotifyTargetID string          `gorm:"column:notify_target_id"`
	Silence        int64           `gorm:"column:silence"`
	SilencePolicy  string          `gorm:"column:silence_policy"`
	Enable         bool            `gorm:"column:enable"`
	Created        time.Time       `gorm:"column:created"`
	Updated        time.Time       `gorm:"column: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) 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 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"`
	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 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) ([]*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"`
	Name             string          `gorm:"column:name"`
	CustomizeAlertID uint64          `gorm:"column:customize_alert_id"`
	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"`
}

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) 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
}

DB .

func New

func New(db *gorm.DB) *DB

New .

func (*DB) Begin

func (db *DB) Begin() *DB

Begin .

Jump to

Keyboard shortcuts

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