Documentation
¶
Overview ¶
Package messagefilter provides composable filters over slices of messages, used to select which messages a context provider stores or forwards. Filters compose with And and Or and remove messages from the input in place.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExternalOnly ¶
ExternalOnly returns only messages whose source type is external.
A zero source type is considered external. The filter operates in place by compacting the input slice.
Types ¶
type Filter ¶
Filter represents a function that filters a slice of messages, potentially returning an error.
Implementations are expected to modify/re-slice the provided slice in place (for example via messages[:0]) and return the filtered view.
Implementations must only remove messages from the input. They must not add new messages that were not already present in the provided slice.
func And ¶
And composes multiple filters and applies them in order.
Nil filters are skipped. If any filter returns an error, execution stops and the error is returned.
func NotSourceTypes ¶
func NotSourceTypes(sourceTypes ...message.SourceType) Filter
NotSourceTypes returns messages whose source type is not in the provided deny list.
func NotSources ¶
NotSources returns messages whose source is not in the provided deny list.