event

package
v0.0.0-...-8c46fe0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(event *Event) bool

Add adds event to the event list

func EventsFromJSON

func EventsFromJSON(path string) error

EventsFromJSON loads events from the json file in path and adds them to the event list

Types

type Event

type Event struct {
	Name      string
	Command   string
	StartDate time.Time
	StopDate  time.Time
	Timeout   time.Duration
	Periodic  bool
	WaitMin   time.Duration
	WaitMax   time.Duration
	// contains filtered or unexported fields
}

Event is an event that can be scheduled

func Flush

func Flush() []*Event

Flush removes all events in the event list and returns the removed events

func Get

func Get(name string) *Event

Get returns the event identified by name

func List

func List() []*Event

List returns all events in the event list

func NewEvent

func NewEvent() *Event

NewEvent returns a new Event

func NewFromJSON

func NewFromJSON(b []byte) (*Event, error)

NewFromJSON parses an event from json

func Remove

func Remove(event *Event) *Event

Remove removes event from the event list

func (*Event) JSON

func (e *Event) JSON() ([]byte, error)

JSON returns the event as json

func (*Event) Run

func (e *Event) Run()

Run executes the event's command once

func (*Event) Schedule

func (e *Event) Schedule()

Schedule schedules the event for execution

func (*Event) Stop

func (e *Event) Stop()

Stop stops a scheduled event

Jump to

Keyboard shortcuts

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