model

package
v1.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PageNumber = 1
	PageSize   = 10
	RuneCount  = 50
)
View Source
const (
	FieldEmpty   = "this field not be empty"
	FieldTooLong = "this field is too long"
	SpaceField   = "this field can't just contain spaces"
	FiledZero    = "this field must not be zero"
)
View Source
const (
	Address        = "群组地址:"
	Role           = "通知角色:"
	DingDingTarget = "dingding"
)

Variables

View Source
var (
	ErrCreateNotify = err("ErrCreateNotify", "创建通知失败")
	ErrGetNotify    = err("ErrGetNotify", "获取通知失败")
	ErrDeleteNotify = err("ErrDeleteNotify", "删除通知失败")
	ErrUpdateNotify = err("ErrUpdateNotify", "更新通知失败")
	ErrNotifyEnable = err("ErrNotifyEnable", "启用通知失败")
)

Functions

func CheckElements

func CheckElements(formats []map[string]string, title, template []string) error

func ValidateInt

func ValidateInt(field int64) string

func ValidateString

func ValidateString(field string) string

Types

type Behavior

type Behavior struct {
	Group string `json:"group" yaml:"group"`
}

type CreateNotifyReq

type CreateNotifyReq struct {
	ScopeID       string            `query:scopeId validate:"required"`
	Scope         string            `query:"scope" validate:"required"`
	TemplateID    []string          `query:"templateId" validate:"required"`
	NotifyName    string            `query:"notifyName" validate:"required"`
	NotifyGroupID int64             `query:"notifyGroupId" validate:"required"`
	Channels      []string          `query:"channels" validate:"required"`
	Attribute     map[string]string `query:"attribute"`
}

func (CreateNotifyReq) CheckNotify

func (c CreateNotifyReq) CheckNotify() error

type CreateUserDefineNotifyTemplate

type CreateUserDefineNotifyTemplate struct {
	Name     string              `query:"name" validate:"required"`
	Group    string              `query:"group" validate:"required"`
	Trigger  []string            `query:"trigger" validate:"required"`
	Formats  []map[string]string `query:"formats" validate:"required"`
	Title    []string            `query:"title" validate:"required"`
	Template []string            `query:"template" validate:"required"`
	Scope    string              `query:"scope" validate:"required"`
	ScopeID  string              `query:"scopeId" validate:"required"`
	Targets  []string            `query:"targets" validate:"required"`
}

func (CreateUserDefineNotifyTemplate) CheckCustomizeNotify

func (c CreateUserDefineNotifyTemplate) CheckCustomizeNotify() error

type GetAllGroupData

type GetAllGroupData struct {
	Name  string `json:"name"`
	Value int64  `json:"value"`
	Type  string `json:"type"`
}

type GetNotifyRes

type GetNotifyRes struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type GroupInfo

type GroupInfo struct {
	Id         int64  `json:"id"`
	TargetData string `json:"targetData"`
}

type Metadata

type Metadata struct {
	Name   string   `json:"name" yaml:"name"`
	Type   string   `json:"type" yaml:"type"`
	Module string   `json:"module" yaml:"module"`
	Scope  []string `json:"scope" yaml:"scope"`
}

type Model

type Model struct {
	ID        string      `json:"id" yaml:"id"` //id is not the database generated auto id
	Metadata  Metadata    `json:"metadata" yaml:"metadata"`
	Behavior  Behavior    `json:"behavior" yaml:"behavior"`
	Templates []Templates `json:"templates" yaml:"templates"`
}

the complete template,ID just like addon_elasticsearch_cpu

type NotifyDetailResponse

type NotifyDetailResponse struct {
	Id         int64  `json:"id"`
	NotifyID   string `json:"notifyId"`
	NotifyName string `json:"notifyName"`
	Target     string `json:"target"`
	GroupType  string `json:"groupType"`
}

type NotifyRecord

type NotifyRecord struct {
	NotifyId    string `json:"notify_id" gorm:"column:notify_id"`
	NotifyName  string `json:"notify_name" gorm:"column:notify_name"`
	ScopeType   string `json:"scope_type" gorm:"column:scope_type"`
	ScopeId     int64  `json:"scope_id" gorm:"column:scope_id"`
	GroupId     string `json:"group_id" gorm:"column:group_id"`
	NotifyGroup string `json:"notify_group" gorm:"column:notify_group"`
	Title       string `json:"title" gorm:"column:title"`
	NotifyTime  int64  `json:"notify_time" gorm:"column:notify_time"`
	CreateTime  int64  `json:"create_time" gorm:"column:create_time"`
	UpdateTime  int64  `json:"update_time" gorm:"column:update_time"`
}

type NotifyRes

type NotifyRes struct {
	CreatedAt    time.Time      `json:"createdAt"`
	Id           int64          `json:"id"`
	NotifyID     string         `json:"notifyId"`
	NotifyName   string         `json:"notifyName"`
	Target       string         `json:"target"`
	NotifyTarget []NotifyTarget `json:"groupInfo"`
	Enable       bool           `json:"enable"`
	Items        []string       `json:"items"`
}

type NotifyTarget

type NotifyTarget struct {
	Type   string        `json:"type"`
	Values []TargetValue `json:"values"`
}

type QueryNotifyListReq

type QueryNotifyListReq struct {
	Scope   string
	ScopeID string
}

type QueryNotifyListRes

type QueryNotifyListRes struct {
	List []NotifyRes
}

type Render

type Render struct {
	Formats  map[string]string `json:"formats" yaml:"formats"`
	Title    string            `json:"title" yaml:"title"`
	Template string            `json:"template" yaml:"template"`
}

type Target

type Target struct {
	GroupID     int64    `json:"group_id"`
	Channels    []string `json:"channels"`
	DingDingUrl string   `json:"dingdingUrl"`
}

type TargetValue

type TargetValue struct {
	Receiver string `json:"receiver"`
	// only dingding used
	Secret string `json:"secret"`
}

type Templates

type Templates struct {
	Trigger []string `json:"trigger" yaml:"trigger"`
	Targets []string `json:"targets" yaml:"targets"`
	I18n    []string `json:"i18n" yaml:"i18n"`
	Render  `json:"render" yaml:"render"`
}

type UpdateNotifyReq

type UpdateNotifyReq struct {
	ID            int64             `param:"id" validate:"required"`
	Scope         string            `query:"scope" validate:"required"`
	ScopeID       string            `query:"scopeId" validate:"required"`
	Channels      []string          `query:"channels" validate:"required"`
	NotifyGroupID int64             `query:"notifyGroupId" validate:"required"`
	TemplateId    []string          `query:"templateId" validate:"required"`
	Attribute     map[string]string `query:"attribute"`
}

func (UpdateNotifyReq) CheckNotify

func (c UpdateNotifyReq) CheckNotify() error

Jump to

Keyboard shortcuts

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