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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToTime

func ToTime(timestampStr string) (time.Time, error)

Types

type AlertNotifyIndex

type AlertNotifyIndex struct {
	ID         int64     `json:"id" gorm:"column:id"`
	NotifyID   int64     `json:"notifyID" gorm:"column:notify_id"`
	NotifyName string    `json:"notifyName" gorm:"column:notify_name"`
	Status     string    `json:"status" gorm:"column:status"`
	Channel    string    `json:"channel" gorm:"column:channel"`
	Attributes string    `json:"attributes" gorm:"column:attributes"`
	ScopeType  string    `json:"scopeType" gorm:"column:scope_type"`
	ScopeID    string    `json:"scopeID" gorm:"column:scope_id"`
	OrgID      int64     `json:"org_id" gorm:"column:org_id"`
	CreatedAt  time.Time `json:"created_at" gorm:"column:created_at"`
	SendTime   time.Time `json:"sendTime" gorm:"column:send_time"`
	AlertId    int64     `json:"alertId,gorm:"column:alert_id"`
}

func (AlertNotifyIndex) TableName

func (AlertNotifyIndex) TableName() string

type AlertNotifyIndexDB

type AlertNotifyIndexDB struct {
	*gorm.DB
}

func (*AlertNotifyIndexDB) CreateAlertNotifyIndex

func (db *AlertNotifyIndexDB) CreateAlertNotifyIndex(alertNotifyIndex *AlertNotifyIndex) (int64, error)

func (*AlertNotifyIndexDB) GetAlertNotifyIndex

func (db *AlertNotifyIndexDB) GetAlertNotifyIndex(id int64) (*AlertNotifyIndex, error)

func (*AlertNotifyIndexDB) QueryAlertNotifyHistories

func (db *AlertNotifyIndexDB) QueryAlertNotifyHistories(queryRequest *model.QueryAlertNotifyIndexRequest) ([]AlertNotifyIndex, int64, error)

type DB

type DB struct {
	*gorm.DB
	AlertNotifyIndexDB AlertNotifyIndexDB
	NotifyHistoryDB    NotifyHistoryDB
	AlertNotifyDB      alertdb.AlertNotifyDB
}

func New

func New(db *gorm.DB) *DB

func (*DB) Begin

func (db *DB) Begin() *DB

type NotifyHistory

type NotifyHistory struct {
	model.BaseModel
	NotifyName            string `gorm:"size:150;index:idx_notify_name"`
	NotifyItemDisplayName string `gorm:"size:150"`
	Channel               string `gorm:"size:150"`
	TargetData            string `gorm:"type:text"`
	SourceData            string `gorm:"type:text"`
	Status                string `gorm:"size:150"`
	OrgID                 int64  `gorm:"index:idx_org_id"`
	SourceType            string `gorm:"size:150"`
	SourceID              string `gorm:"size:150"`
	ErrorMsg              string `gorm:"type:text"`
	// 模块类型 cdp/workbench/monitor
	Label       string `gorm:"size:150;index:idx_module"`
	ClusterName string
}

func (NotifyHistory) TableName

func (NotifyHistory) TableName() string

TableName 设置模型对应数据库表名称

func (*NotifyHistory) ToApiData

func (notifyHistory *NotifyHistory) ToApiData() (*pb.NotifyHistory, error)

type NotifyHistoryDB

type NotifyHistoryDB struct {
	*gorm.DB
}

func (*NotifyHistoryDB) CreateNotifyHistory

func (db *NotifyHistoryDB) CreateNotifyHistory(request *NotifyHistory) (*NotifyHistory, error)

func (*NotifyHistoryDB) FilterStatus

func (db *NotifyHistoryDB) FilterStatus(request *model.FilterStatusRequest) ([]*model.FilterStatusResult, error)

func (*NotifyHistoryDB) GetAlertNotifyHistory

func (db *NotifyHistoryDB) GetAlertNotifyHistory(id int64) (*NotifyHistory, error)

func (*NotifyHistoryDB) NotifyHistoryType

func (db *NotifyHistoryDB) NotifyHistoryType(key string, orgId int, scopeId, scopeType string, startTime, endTime int64) ([]*model.NotifyValue, error)

func (*NotifyHistoryDB) QueryNotifyHistories

func (db *NotifyHistoryDB) QueryNotifyHistories(request *model.QueryNotifyHistoriesRequest) ([]NotifyHistory, int64, error)

func (*NotifyHistoryDB) QueryNotifyValue

func (db *NotifyHistoryDB) QueryNotifyValue(key string, orgId int, scopeId, scopeType string, interval, startTime, endTime int64) ([]*model.NotifyValue, error)

Jump to

Keyboard shortcuts

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