Documentation ¶
Index ¶
- func GenerateSubId() (string, error)
- func GetRangeFilter(op, fName string) (func(a, b int64) bool, error)
- func GetStringFilter(op, fName string) (func(s0, s1 string) bool, error)
- func Multiplex(events ...EventEmitter) *multiplexedEvents
- func NewEvents(eventSwitch go_events.EventSwitch, logger loggers.InfoTraceLogger) *events
- func ParseNumberValue(value string) (int64, error)
- type CompositeFilter
- type ConfigurableFilter
- type EventCache
- type EventEmitter
- type EventSub
- type EventSubscriptions
- type EventUnsub
- type Filter
- type FilterData
- type FilterFactory
- type MatchAllFilter
- type PollResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSubId ¶
func Multiplex ¶
func Multiplex(events ...EventEmitter) *multiplexedEvents
Provides an EventEmitter that wraps many underlying EventEmitters as a convenience for Subscribing and Unsubscribing on multiple EventEmitters at once
func NewEvents ¶
func NewEvents(eventSwitch go_events.EventSwitch, logger loggers.InfoTraceLogger) *events
func ParseNumberValue ¶
Types ¶
type CompositeFilter ¶
type CompositeFilter struct {
// contains filtered or unexported fields
}
Filter made up of many filters.
func (*CompositeFilter) Match ¶
func (this *CompositeFilter) Match(v interface{}) bool
func (*CompositeFilter) SetData ¶
func (this *CompositeFilter) SetData(filters []Filter)
type ConfigurableFilter ¶
type ConfigurableFilter interface { Filter Configure(*FilterData) error }
A filter that can be configured with in-data.
type EventCache ¶
type EventCache struct {
// contains filtered or unexported fields
}
type EventEmitter ¶
type EventSubscriptions ¶
type EventSubscriptions struct {
// contains filtered or unexported fields
}
Catches events that callers subscribe to and adds them to an array ready to be polled.
func NewEventSubscriptions ¶
func NewEventSubscriptions(eventEmitter EventEmitter) *EventSubscriptions
func (*EventSubscriptions) Add ¶
func (this *EventSubscriptions) Add(eventId string) (string, error)
Add a subscription and return the generated id. Note event dispatcher has to call func which involves acquiring a mutex lock, so might be a delay - though a conflict is practically impossible, and if it does happen it's for an insignificant amount of time (the time it takes to carry out EventCache.poll() ).
func (*EventSubscriptions) Poll ¶
func (this *EventSubscriptions) Poll(subId string) ([]interface{}, error)
func (*EventSubscriptions) Remove ¶
func (this *EventSubscriptions) Remove(subId string) error
type FilterData ¶
type FilterData struct { Field string `json:"field"` Op string `json:"op"` Value string `json:"value"` }
Used to filter. Op can be any of the following: The usual relative operators: <, >, <=, >=, ==, != (where applicable) A range parameter (see: https://help.github.com/articles/search-syntax/)
type FilterFactory ¶
type FilterFactory struct {
// contains filtered or unexported fields
}
Used to generate filters based on filter data. Keeping separate pools for "edge cases" (Composite and MatchAll)
func NewFilterFactory ¶
func NewFilterFactory() *FilterFactory
func (*FilterFactory) NewFilter ¶
func (this *FilterFactory) NewFilter(fdArr []*FilterData) (Filter, error)
Creates a new filter given the input data array. If the array is zero length or nil, an empty filter will be returned that returns true on all matches. If the array is of size 1, a regular filter is returned, otherwise a CompositeFieldFilter is returned, which is a special filter that contains a number of other filters. It implements AccountFieldFilter, and will match an account only if all the sub-filters matches.
func (*FilterFactory) RegisterFilterPool ¶
func (this *FilterFactory) RegisterFilterPool(fieldName string, pool *sync.Pool)
type MatchAllFilter ¶
type MatchAllFilter struct{}
Rubberstamps everything.
func (*MatchAllFilter) Match ¶
func (this *MatchAllFilter) Match(v interface{}) bool