model

package
v0.0.0-...-d7ec450 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUpsertAllColumns

func GetUpsertAllColumns(value interface{}) []string

GetUpsertAllColumns return all column names

func GetUpsertAppendColumns

func GetUpsertAppendColumns(value interface{}, columns []string) []string

GetUpsertAppendColumns return all column names

func OpenDatabase

func OpenDatabase()

OpenDatabase new database connection

Types

type Hook

type Hook struct {
	HookID      string       `form:"hook_id"      json:"hook_id"       gorm:"column:hook_id;      type:varchar(32) not null default ''; primaryKey"`
	AlertName   string       `` /* 131-byte string literal not displayed */
	Instance    string       `` /* 131-byte string literal not displayed */
	Job         string       `form:"job"          json:"job"           gorm:"column:job;          type:varchar(20) not null default ''"`
	Level       string       `form:"level"        json:"level"         gorm:"column:level;        type:varchar(20) not null default ''"`
	Ignored     string       `` /* 134-byte string literal not displayed */
	Status      string       `form:"status"       json:"status"        gorm:"column:status;       type:varchar(10) not null default ''"`
	StartsAt    *time.Time   `` /* 189-byte string literal not displayed */
	EndsAt      *time.Time   `form:"ends_at"      json:"ends_at"       gorm:"column:ends_at;      type:datetime(3) null"`
	HookDetails []HookDetail `json:"hook_details" gorm:"foreignKey:HookID"`
	UpdatedAt   time.Time    `json:"updated_at"`
}

Hook Hook

func (*Hook) GetList

func (o *Hook) GetList(limit int) (r []Hook, err error)

func (*Hook) Upsert

func (o *Hook) Upsert(hookColumns ...string) error

Upsert insert on duplicate update

type HookDetail

type HookDetail struct {
	ID        int
	HookID    string    `json:"hook_id"       gorm:"column:hook_id;      type:varchar(32) not null default ''; index:ix_hookid"`
	Status    string    `json:"status"        gorm:"column:status;       type:varchar(10) not null default '';"`
	ReqJSON   string    `json:"req_json"      gorm:"column:req_json;     type:json not null"`
	Message   string    `json:"message"       gorm:"column:message;      type:text not null"`
	CreatedAt time.Time `json:"created_at"`
}

HookDetail hook detail

type HookIgnore

type HookIgnore struct {
	Instance  string     `form:"instance"    json:"instance"      gorm:"column:instance;     type:varchar(32) not null default '*'; primaryKey"`
	AlertName string     `form:"alert_name"  json:"alert_name"    gorm:"column:alert_name;   type:varchar(32) not null default '*'; primaryKey"`
	Job       string     `form:"job"         json:"job"           gorm:"column:job;          type:varchar(20) not null default '*'"`
	Status    string     `form:"status"      json:"status"        gorm:"column:status;       type:varchar(10) not null default '*'; primaryKey"`
	Forever   bool       `form:"forever"     json:"forever"       gorm:"column:forever;      type:tinyint not null default false"`
	StartsAt  *time.Time `form:"starts_at"   json:"starts_at"     gorm:"column:starts_at;    type:datetime not null"`
	EndsAt    *time.Time `form:"ends_at"     json:"ends_at"       gorm:"column:ends_at;      type:datetime not null"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
}

HookIgnore hook ignore target

func (*HookIgnore) Delete

func (o *HookIgnore) Delete() (int64, error)

Delete delete row

func (*HookIgnore) GetKey

func (o *HookIgnore) GetKey() (md5 string)

GetKey get hook ignore key

func (*HookIgnore) GetList

func (o *HookIgnore) GetList() (r []HookIgnore, err error)

func (*HookIgnore) IsTarget

func (o *HookIgnore) IsTarget() bool

IsTarget check map

func (*HookIgnore) Upsert

func (o *HookIgnore) Upsert() (rows int64, err error)

Upsert insert on duplicate update

type Notification

type Notification struct {
	Alertname string `form:"alertname" json:"alertname"`
	Instance  string `form:"instance"  json:"instance"`
	Level     string `form:"level"     json:"level"`
	Summary   string `form:"summary"   json:"summary"`
	Message   string `form:"message"   json:"message"`
}

Notification notification alert - single alert

func (*Notification) CheckForm

func (o *Notification) CheckForm() error

CheckForm check form

Jump to

Keyboard shortcuts

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