scheduler

package module
v0.0.0-...-16a93ef Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: MIT Imports: 5 Imported by: 3

README

scheduler

A FAIRE.

Go Report Card Go Reference

Licence

MIT.


Copyright (c) 2021-2022 losyme

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	OnMessage OnMessage
	Logger    Logger
}

func NewConfig

func NewConfig(onMessage OnMessage, options ...Option) *Config

type Event

type Event struct {
	Name     string        `cfg:"name"`
	Disabled bool          `cfg:"disabled"`
	After    time.Duration `cfg:"after"`
	Repeat   string        `cfg:"repeat"`
	Data     interface{}   `cfg:"data"`
}

type Logger

type Logger interface {
	zombie.Logger
	Error(msg string, kv ...interface{})
}

type Message

type Message struct {
	Event string
	Data  interface{}
}

type OnMessage

type OnMessage func(*Message)

type Option

type Option func(*Config)

func WithLogger

func WithLogger(logger Logger) Option

type Scheduler

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

func New

func New(c *Config) (*Scheduler, error)

func (*Scheduler) AddEvent

func (s *Scheduler) AddEvent(e *Event) error

func (*Scheduler) Start

func (s *Scheduler) Start()

func (*Scheduler) Stop

func (s *Scheduler) Stop()

Jump to

Keyboard shortcuts

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