notifications

package
v0.90.74 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDB

func SetDB(database database.Database)

Types

type Notification

type Notification struct {
	Id          int64           `gorm:"primary_key;column:id" json:"id"`
	Method      string          `gorm:"column:method" json:"method"`
	Host        null.NullString `gorm:"column:host" json:"host,omitempty"`
	Port        null.NullInt64  `gorm:"column:port" json:"port,omitempty"`
	Username    null.NullString `gorm:"column:username" json:"username,omitempty"`
	Password    null.NullString `gorm:"column:password" json:"password,omitempty"`
	Var1        null.NullString `gorm:"column:var1" json:"var1,omitempty"`
	Var2        null.NullString `gorm:"column:var2" json:"var2,omitempty"`
	ApiKey      null.NullString `gorm:"column:api_key" json:"api_key,omitempty"`
	ApiSecret   null.NullString `gorm:"column:api_secret" json:"api_secret,omitempty"`
	Enabled     null.NullBool   `gorm:"column:enabled;type:boolean;default:false" json:"enabled,omitempty"`
	Limits      int             `gorm:"not null;column:limits" json:"limits"`
	Removable   bool            `gorm:"column:removable" json:"removable"`
	SuccessData null.NullString `gorm:"type:text;column:success_data" json:"success_data,omitempty"`
	FailureData null.NullString `gorm:"type:text;column:failure_data" json:"failure_data,omitempty"`
	DataType    string          `gorm:"-" json:"data_type,omitempty"`
	RequestInfo string          `gorm:"-" json:"request_info,omitempty"`
	CreatedAt   time.Time       `gorm:"column:created_at" json:"created_at"`
	UpdatedAt   time.Time       `gorm:"column:updated_at" json:"updated_at"`
	Title       string          `gorm:"-" json:"title"`
	Description string          `gorm:"-" json:"description"`
	Author      string          `gorm:"-" json:"author"`
	AuthorUrl   string          `gorm:"-" json:"author_url"`
	Icon        string          `gorm:"-" json:"icon"`
	Delay       time.Duration   `gorm:"-" json:"delay,string"`

	Form          []NotificationForm `gorm:"-" json:"form"`
	LastSent      time.Time          `gorm:"-" json:"-"`
	LastSentCount int                `gorm:"-" json:"-"`
	Logs          []*NotificationLog `gorm:"-" json:"logs,omitempty"`
}

Notification contains all the fields for a Statping Notifier.

func All added in v0.90.65

func All() []*Notification

func Find

func Find(method string) (*Notification, error)

func (*Notification) AfterCreate added in v0.90.53

func (n *Notification) AfterCreate()

func (*Notification) AfterDelete added in v0.90.53

func (n *Notification) AfterDelete()

func (*Notification) AfterFind

func (n *Notification) AfterFind() (err error)

func (*Notification) AfterUpdate added in v0.90.53

func (n *Notification) AfterUpdate()

func (*Notification) CanSend

func (n *Notification) CanSend() bool

func (*Notification) Create

func (n *Notification) Create() error

func (*Notification) GetValue

func (n *Notification) GetValue(dbField string) string

GetValue returns the database value of a accept DbField value.

func (Notification) LastSentDur added in v0.90.62

func (n Notification) LastSentDur() time.Duration

LastSent returns a time.Duration of the last sent notification for the notifier

func (*Notification) Logger added in v0.90.22

func (n *Notification) Logger() *logrus.Logger

func (Notification) Name

func (n Notification) Name() string

func (*Notification) Update

func (n *Notification) Update() error

func (*Notification) UpdateFields added in v0.90.17

func (n *Notification) UpdateFields(notif *Notification) *Notification

func (*Notification) Values added in v0.90.62

func (n *Notification) Values() Values

type NotificationForm

type NotificationForm struct {
	Type        string   `json:"type"`        // the html input type (text, password, email)
	Title       string   `json:"title"`       // include a title for ease of use
	Placeholder string   `json:"placeholder"` // add a placeholder for the input
	DbField     string   `json:"field"`       // true variable key for input
	SmallText   string   `json:"small_text"`  // insert small text under a html input
	Required    bool     `json:"required"`    // require this input on the html form
	IsHidden    bool     `json:"hidden"`      // hide this form element from end user
	ListOptions []string `json:"list_options,omitempty"`
}

NotificationForm contains the HTML fields for each variable/input you want the notifier to accept.

type NotificationLog added in v0.90.62

type NotificationLog struct {
	Message   string    `gorm:"-" json:"message"`
	Error     error     `gorm:"-" json:"error,omitempty"`
	Success   bool      `gorm:"-" json:"success"`
	Service   int64     `gorm:"-" json:"service"`
	CreatedAt time.Time `gorm:"-" json:"created_at"`
}

type NotificationOrder added in v0.90.22

type NotificationOrder []Notification

NotificationOrder will reorder the services based on 'order_id' (Order)

func (NotificationOrder) Len added in v0.90.22

func (c NotificationOrder) Len() int

Sort interface for resorting the Notifications in order

func (NotificationOrder) Less added in v0.90.22

func (c NotificationOrder) Less(i, j int) bool

func (NotificationOrder) Swap added in v0.90.22

func (c NotificationOrder) Swap(i, j int)

type Values added in v0.90.62

type Values struct {
	Host      string
	Port      int64
	Username  string
	Password  string
	Var1      string
	Var2      string
	ApiKey    string
	ApiSecret string
}

Jump to

Keyboard shortcuts

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