Library for delayed sending message to channel with ability to cancel sending.
go get github.com/horockey/go-scheduler@latest
See /example directory
Library is working with entities called events. Event is simply payload, wrapped with tags and headers:
type Event[T any] struct {
Payload T
tags map[string]struct{}
headers map[string]string
}
Creating event via NewEvent()
method sets 2 default headers to it:
CREATED_AT
header is set totime.Now()
ID
header is set touuid.NewString()
You are free to add any tags and headers to your events.
Adding new tags and headers to event keep in mind, that they will be canonicalized (strings.ToUpper()
) before actual addition to event