settingModel

package
v0.0.0-...-fdfd418 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SlackCode        = "slack"
	SlackUrlKey      = "url"
	SlackTemplateKey = "template"
	SlackChannelKey  = "channel"
)
View Source
const (
	MailCode        = "mail"
	MailTemplateKey = "template"
	MailServerKey   = "server"
	MailUserKey     = "user"
)
View Source
const (
	WebhookCode        = "webhook"
	WebhookTemplateKey = "template"
	WebhookUrlKey      = "url"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type Mail

type Mail struct {
	Host      string     `json:"host"`
	Port      int        `json:"port"`
	User      string     `json:"user"`
	Password  string     `json:"password"`
	MailUsers []MailUser `json:"mailUsers"`
	Template  string     `json:"template"`
}

type MailUser

type MailUser struct {
	Id       int    `json:"id"`
	Username string `json:"username"`
	Email    string `json:"email"`
}

type Setting

type Setting struct {
	Id    int    `gorm:"type:int(20); primary_key; auto_increment; not null"`
	Code  string `gorm:"type:varchar(100); not null"`
	Key   string `gorm:"type:varchar(100); not null"`
	Value string `gorm:"type:varchar(4096); not null; default '' "`
}

func (*Setting) CreateChannel

func (setting *Setting) CreateChannel(channel string) *Setting

创建slack渠道

func (*Setting) CreateMailUser

func (setting *Setting) CreateMailUser(username, email string)

func (*Setting) InitBasicField

func (setting *Setting) InitBasicField()

初始化基本字段 邮件、slack等

func (*Setting) IsChannelExist

func (setting *Setting) IsChannelExist(channel string) bool

func (*Setting) Mail

func (setting *Setting) Mail() Mail

region 邮件配置

func (*Setting) RemoveChannel

func (setting *Setting) RemoveChannel(id int)

删除slack渠道

func (*Setting) RemoveMailUser

func (setting *Setting) RemoveMailUser(id int)

func (*Setting) Slack

func (setting *Setting) Slack() Slack

func (*Setting) UpdateMail

func (setting *Setting) UpdateMail(config, template string)

func (*Setting) UpdateSlack

func (setting *Setting) UpdateSlack(url, template string)

func (*Setting) UpdateWebHook

func (setting *Setting) UpdateWebHook(url, template string)

func (*Setting) Webhook

func (setting *Setting) Webhook() WebHook

type Slack

type Slack struct {
	Url      string    `json:"url"`
	Channels []Channel `json:"channels"`
	Template string    `json:"template"`
}

region slack配置

type WebHook

type WebHook struct {
	Url      string `json:"url"`
	Template string `json:"template"`
}

Jump to

Keyboard shortcuts

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