notifiers

package
v0.29.9 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMAIL_ID     int64 = 1
	EMAIL_METHOD       = "email"
)
View Source
const (
	SLACK_ID     = 2
	SLACK_METHOD = "slack"
)

Variables

View Source
var (
	AllCommunications []AllNotifiers
	Collections       db.Collection
)

Functions

func EmailTemplate

func EmailTemplate(box *rice.Box, tmpl string, data interface{}) string

func InsertDatabase

func InsertDatabase(n *Notification) (int64, error)

func OnFailure

func OnFailure()

func OnSuccess

func OnSuccess()

func SendEmail

func SendEmail(box *rice.Box, email *types.Email)

func SendSlack

func SendSlack(msg string) error

CUSTOM FUNCTION FO SENDING SLACK MESSAGES

Types

type AllNotifiers

type AllNotifiers interface{}

func Load

func Load() []AllNotifiers

type Email

type Email struct {
	*Notification
	// contains filtered or unexported fields
}

func (*Email) Init

func (u *Email) Init() error

WHEN NOTIFIER LOADS

func (*Email) Install

func (u *Email) Install() error

ON SERVICE FAILURE, DO YOUR OWN FUNCTIONS

func (*Email) OnFailure

func (u *Email) OnFailure() error

ON SERVICE FAILURE, DO YOUR OWN FUNCTIONS

func (*Email) OnSave

func (u *Email) OnSave() error

ON SAVE OR UPDATE OF THE NOTIFIER FORM

func (*Email) OnSuccess

func (u *Email) OnSuccess() error

ON SERVICE SUCCESS, DO YOUR OWN FUNCTIONS

func (*Email) Run

func (u *Email) Run() error

AFTER NOTIFIER LOADS, IF ENABLED, START A QUEUE PROCESS

func (*Email) Select

func (u *Email) Select() *Notification

Select Obj

func (*Email) Test

func (u *Email) Test() error

type Notification

type Notification struct {
	Id        int64     `db:"id,omitempty" json:"id"`
	Method    string    `db:"method" json:"method"`
	Host      string    `db:"host" json:"-"`
	Port      int       `db:"port" json:"-"`
	Username  string    `db:"username" json:"-"`
	Password  string    `db:"password" json:"-"`
	Var1      string    `db:"var1" json:"-"`
	Var2      string    `db:"var2" json:"-"`
	ApiKey    string    `db:"api_key" json:"-"`
	ApiSecret string    `db:"api_secret" json:"-"`
	Enabled   bool      `db:"enabled" json:"enabled"`
	Limits    int64     `db:"limits" json:"-"`
	Removable bool      `db:"removable" json:"-"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	Form      []NotificationForm
	Routine   chan struct{}
}

func Select

func Select(id int64) *Notification

func SelectNotification

func SelectNotification(id int64) (*Notification, error)

func (*Notification) GetValue

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

func (*Notification) Update

func (n *Notification) Update() (*Notification, error)

type NotificationForm

type NotificationForm struct {
	Type        string
	Title       string
	Placeholder string
	DbField     string
	// contains filtered or unexported fields
}

func (NotificationForm) Value

func (f NotificationForm) Value() string

type Notifier

type Notifier interface {
	Init() error
	Install() error
	Run() error
	OnFailure() error
	OnSuccess() error
	Select() *Notification
	Test() error
}

func SelectNotifier

func SelectNotifier(id int64) Notifier

type Slack

type Slack struct {
	*Notification
}

func (*Slack) Init

func (u *Slack) Init() error

WHEN NOTIFIER LOADS

func (*Slack) Install

func (u *Slack) Install() error

ON SERVICE FAILURE, DO YOUR OWN FUNCTIONS

func (*Slack) OnFailure

func (u *Slack) OnFailure() error

ON SERVICE FAILURE, DO YOUR OWN FUNCTIONS

func (*Slack) OnSave

func (u *Slack) OnSave() error

ON SAVE OR UPDATE OF THE NOTIFIER FORM

func (*Slack) OnSuccess

func (u *Slack) OnSuccess() error

ON SERVICE SUCCESS, DO YOUR OWN FUNCTIONS

func (*Slack) Run

func (u *Slack) Run() error

AFTER NOTIFIER LOADS, IF ENABLED, START A QUEUE PROCESS

func (*Slack) Select

func (u *Slack) Select() *Notification

Select Obj

func (*Slack) Test

func (u *Slack) Test() error

Jump to

Keyboard shortcuts

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