notify

package
v0.0.0-...-efb87f3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contact

type Contact struct {
	database.Object `storm:"inline"`
	Name            string          `json:"name" validate:"required"`
	Notifier        string          `json:"notifier" validate:"required"`
	Arguments       json.RawMessage `json:"arguments"`
}

Contact is a person or service capable of receiving notifications.

func LoadContact

func LoadContact(db database.Reader, id string) (*Contact, error)

LoadContact will read a contact from db.

func (*Contact) Notify

func (c *Contact) Notify(text string) error

Notify contacts a Contact about a service change.

func (*Contact) Validate

func (c *Contact) Validate(db database.Reader) error

Validate implements database.Validator.

type ContactGroup

type ContactGroup struct {
	database.Object `storm:"inline"`
	Name            string   `json:"name" validate:"required"`
	Members         []string `json:"members"`
}

ContactGroup is a group of contacts.

func LoadContactGroup

func LoadContactGroup(db database.Reader, id string) (*ContactGroup, error)

LoadContactGroup will read a contact from db.

func (*ContactGroup) GetContacts

func (g *ContactGroup) GetContacts(db database.Reader) ([]*Contact, error)

GetContacts returns the list of contacts in g.

func (*ContactGroup) Validate

func (g *ContactGroup) Validate(db database.Reader) error

Validate implements database.Validator.

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

Notifier takes care of notifying all contacts in a relevant ContactGroup.

func NewNotifier

func NewNotifier(db database.Reader) (*Notifier, error)

NewNotifier will start a new notifier service.

func (*Notifier) PostApply

func (n *Notifier) PostApply(leader bool, command database.Command, data interface{})

PostApply implements database.Listener.

Jump to

Keyboard shortcuts

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