Documentation ¶
Index ¶
- func Match(pattern, name string) (matched bool)
- func MatchSimple(pattern, name string) bool
- type DefaultEventBus
- func (eb *DefaultEventBus) HasCallback(topic string) bool
- func (eb *DefaultEventBus) Publish(topic string, args ...interface{})
- func (eb *DefaultEventBus) Subscribe(topic string, fn interface{}) error
- func (eb *DefaultEventBus) SubscribeAsync(topic string, fn interface{}, transactional bool) error
- func (eb *DefaultEventBus) SubscribeOnce(topic string, fn interface{}) error
- func (eb *DefaultEventBus) SubscribeOnceAsync(topic string, fn interface{}) error
- func (eb *DefaultEventBus) Unsubscribe(topic string, handler interface{}) error
- func (eb *DefaultEventBus) WaitAsync()
- type EventBus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Match ¶
Match - finds whether the text matches/satisfies the pattern string. supports '*' and '?' wildcards in the pattern string. unlike path.Match(), considers a path as a flat name space while matching the pattern. The difference is illustrated in the example here https://play.golang.org/p/Ega9qgD4Qz .
func MatchSimple ¶
MatchSimple - finds whether the text matches/satisfies the pattern string. supports only '*' wildcard in the pattern. considers a file system path as a flat name space.
Types ¶
type DefaultEventBus ¶
type DefaultEventBus struct {
// contains filtered or unexported fields
}
DefaultEventBus - box for handlers and callbacks.
func (*DefaultEventBus) HasCallback ¶
func (eb *DefaultEventBus) HasCallback(topic string) bool
HasCallback returns true if exists any callback subscribed to the topic.
func (*DefaultEventBus) Publish ¶
func (eb *DefaultEventBus) Publish(topic string, args ...interface{})
Publish executes callback defined for a topic. Any additional argument will be transferred to the callback.
func (*DefaultEventBus) Subscribe ¶
func (eb *DefaultEventBus) Subscribe(topic string, fn interface{}) error
Subscribe subscribes to a topic. Returns error if `fn` is not a function.
func (*DefaultEventBus) SubscribeAsync ¶
func (eb *DefaultEventBus) SubscribeAsync(topic string, fn interface{}, transactional bool) error
SubscribeAsync subscribes to a topic with an asynchronous callback Transactional determines whether subsequent callbacks for a topic are run serially (true) or concurrently (false) Returns error if `fn` is not a function.
func (*DefaultEventBus) SubscribeOnce ¶
func (eb *DefaultEventBus) SubscribeOnce(topic string, fn interface{}) error
SubscribeOnce subscribes to a topic once. Handler will be removed after executing. Returns error if `fn` is not a function.
func (*DefaultEventBus) SubscribeOnceAsync ¶
func (eb *DefaultEventBus) SubscribeOnceAsync(topic string, fn interface{}) error
SubscribeOnceAsync subscribes to a topic once with an asynchronous callback Handler will be removed after executing. Returns error if `fn` is not a function.
func (*DefaultEventBus) Unsubscribe ¶
func (eb *DefaultEventBus) Unsubscribe(topic string, handler interface{}) error
Unsubscribe removes callback defined for a topic. Returns error if there are no callbacks subscribed to the topic.
func (*DefaultEventBus) WaitAsync ¶
func (eb *DefaultEventBus) WaitAsync()
WaitAsync waits for all async callbacks to complete