events

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initial

func Initial()

func OnEvent

func OnEvent(event Event)

OnEvent push event to gorotine pool then handled automatic.

func RemoveJob

func RemoveJob(id EntryID)

RemoveJob an entry from being run in the future.

func StartEventManager

func StartEventManager()

func StartJobManager

func StartJobManager()

func StopEventManager

func StopEventManager()

func StopJobManager

func StopJobManager()

Types

type EntryID

type EntryID = cron.EntryID

func OnTask

func OnTask(s cron.Schedule, fn JobFn) EntryID

OnTask adds a Job to the Cron to be run on the given schedule. The job is wrapped with the configured Chain.

func Schedule

func Schedule(job Job) EntryID

Schedule adds a Job to the Cron to be run on the given schedule. The job is wrapped with the configured Chain.

type Event

type Event = event.Event

type EventManager

type EventManager interface {
	Start()
	Stop()
	OnEvent(event Event)
}

func NewEventManager

func NewEventManager(fn pool.RespFn[Event], opts ...pool.Option) EventManager

type Job

type Job interface {
	cron.Schedule
	cron.Job
}

Job job interface

func NewJob

func NewJob(s cron.Schedule, fn JobFn) Job

NewJob create new Job instance

type JobFn

type JobFn func()

JobFn job help function that implement cron.Job interface

func (JobFn) Run

func (fn JobFn) Run()

type JobManager

type JobManager interface {
	Start()
	Stop()
	Remove(id EntryID)
	Schedule(Job) EntryID
}

JobManager job manger interface

func NewJobManager

func NewJobManager() JobManager

Jump to

Keyboard shortcuts

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