valarm

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alarm

type Alarm struct {
	Options *Options
	// contains filtered or unexported fields
}

func New

func New(options map[string]any) (alarm *Alarm, err error)

New create new alarm

func (*Alarm) GetMsg

func (alarm *Alarm) GetMsg(msgM vmap.M) (dataJson string)

GetMsg get message

func (*Alarm) Process

func (alarm *Alarm) Process() (data *gmap.Map)

Process processes message

func (*Alarm) Push

func (alarm *Alarm) Push(title string, service string, trace string, content string)

Push pushes the data into the queue data deduplication rule: service + title + trace

func (*Alarm) Run

func (alarm *Alarm) Run()

Run send msg

func (*Alarm) RunCron

func (alarm *Alarm) RunCron() (err error)

RunCron send msg by cron

func (*Alarm) Send

func (alarm *Alarm) Send(msg string) (err error)

Send sends message

func (*Alarm) SetConfig

func (alarm *Alarm) SetConfig(options map[string]any) (err error)

SetConfig set config

type Options

type Options struct {
	QueueMaxSize int
	SendInterval int // second
	Url          string
}

Jump to

Keyboard shortcuts

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