Documentation ¶
Index ¶
- func Match(pattern, name string) (matched bool)
- func MatchSimple(pattern, name string) bool
- type DefaultEventBus
- func (eb *DefaultEventBus) Close() error
- func (eb *DefaultEventBus) CloseTopic(topic common.TopicType)
- func (eb *DefaultEventBus) HasCallback(topic common.TopicType) bool
- func (eb *DefaultEventBus) Publish(topic common.TopicType, args ...interface{})
- func (eb *DefaultEventBus) Subscribe(topic common.TopicType, fn interface{}) error
- func (eb *DefaultEventBus) SubscribeSync(topic common.TopicType, fn interface{}) error
- func (eb *DefaultEventBus) Unsubscribe(topic common.TopicType, handler interface{}) error
- 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
func (*DefaultEventBus) Close ¶ added in v1.2.0
func (eb *DefaultEventBus) Close() error
func (*DefaultEventBus) CloseTopic ¶ added in v1.2.0
func (eb *DefaultEventBus) CloseTopic(topic common.TopicType)
Close unsubscribe all handlers from given topic
func (*DefaultEventBus) HasCallback ¶
func (eb *DefaultEventBus) HasCallback(topic common.TopicType) bool
HasCallback returns true if exists any callback subscribed to the topic.
func (*DefaultEventBus) Publish ¶
func (eb *DefaultEventBus) Publish(topic common.TopicType, 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 common.TopicType, fn interface{}) error
Subscribe subscribes to a topic. Returns error if `fn` is not a function.
func (*DefaultEventBus) SubscribeSync ¶ added in v1.2.0
func (eb *DefaultEventBus) SubscribeSync(topic common.TopicType, fn interface{}) error
func (*DefaultEventBus) Unsubscribe ¶
func (eb *DefaultEventBus) Unsubscribe(topic common.TopicType, handler interface{}) error
Unsubscribe removes callback defined for a topic. Returns error if there are no callbacks subscribed to the topic. TODO: fix unsubscribe failed
type EventBus ¶
func GetEventBus ¶
func NewEventBus ¶ added in v1.2.0
func SimpleEventBus ¶
func SimpleEventBus() EventBus