Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterEvent ¶ added in v0.8.0
FilterEvent returns false if one of the filters rejects the event
func TransformEvent ¶
func TransformEvent(event models.Event, transformers ...Transformer) models.Event
TransformEvent will transform the given event by applying every transformer given. The final transformed event is returned.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
A Controller can synchronise the events from the sink via the given transformers into the sink
func NewController ¶
func NewController(logger *log.Logger, source Source, sink Sink, transformer []Transformer, filters []Filter) Controller
NewController constructs a new Controller.
func (*Controller) SetConcurrency ¶
func (p *Controller) SetConcurrency(concurrency int)
type Filter ¶ added in v0.8.0
type Filter interface { NamedComponent // Filter returns true to keep the event Filter(event models.Event) bool }
func FilterFactory ¶ added in v0.8.0
type NamedComponent ¶
type NamedComponent interface { // Name returns the name of the NamedComponent. This is used in debugging or error messages mostly. Name() string }
NamedComponent is anything which can be named :).
type RecurrencePattern ¶
type RecurrencePattern string
RecurrencePattern is an RFC5545 conform recurrence pattern
type Sink ¶
type Sink interface { NamedComponent EventsInTimeframe(ctx context.Context, start time.Time, end time.Time) ([]models.Event, error) // CreateEvent creates the given event in the external calendar CreateEvent(ctx context.Context, e models.Event) error // UpdateEvent will update the given event UpdateEvent(ctx context.Context, e models.Event) error // DeleteEvent deletes the given Event in the external calendar DeleteEvent(ctx context.Context, e models.Event) error GetCalendarID() string }
Sink describes a NamedComponent allows write-access to events. A sink has the capability to write events and is most likely a different calendar than the source.
type Source ¶
type Source interface { NamedComponent // EventsInTimeframe return all events in a certain timeframe EventsInTimeframe(ctx context.Context, start time.Time, end time.Time) ([]models.Event, error) GetCalendarID() string }
Source is a NamedComponent which describes the interface of a system (API) which acts as a source of events (aka calendar). A source can only ever be read from. No modifications can be performed on event-sources.
type Transformer ¶
type Transformer interface { NamedComponent // Transform applies the Transformer logic to the event and returns the changed Event. Transform(source models.Event, sink models.Event) (models.Event, error) }
Transformer applies a well-defined transformation to an event. Multiple transformers may be concatenated.
func TransformerFactory ¶
func TransformerFactory(configuredTransformers []config.Transformer) (loadedTransformers []Transformer)
TransformerFactory can build all configured transformers from the config file
func TransformerFromConfig ¶
func TransformerFromConfig(transformer Transformer, config config.CustomMap) Transformer