alert

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadLevel = errors.New("bad level")
)

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Name       string    `json:"name"`
	Level      Level     `json:"level"`
	LastChange time.Time `json:"last_change"`
	Start      time.Time `json:"start"`
	Count      int       `json:"count"`
}

Alert is base struct for store Alert information

func New

func New(name string) *Alert

func (*Alert) Marshal

func (a *Alert) Marshal() []byte

func (*Alert) MarshalLua

func (a *Alert) MarshalLua() *lua.LTable

MarshalLua marshal an Alert to the Lua table

type Alerts

type Alerts []*Alert

func (Alerts) Marshal

func (a Alerts) Marshal() []byte

type Level

type Level int

Level is the type for describe an Alert Level

const (
	// LevelSuccess is Success Level of an alert
	LevelSuccess Level = 1
	// LevelWarn is Waring Level of an alert
	LevelWarn Level = 2
	// LevelError is Error Level of an alert
	LevelError Level = 3
)

func LevelFromInt

func LevelFromInt(i int) (Level, error)

LevelFromInt returns Level based on provided int or error

func LevelFromString

func LevelFromString(s string) (Level, error)

LevelFromString returns Level based on provided string or error

func (Level) NumString

func (l Level) NumString() string

func (Level) String

func (l Level) String() string

type Options

type Options struct {
	Channels []string
	Quiet    bool
	Repeat   int
	Image    string
}

Jump to

Keyboard shortcuts

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