Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶ added in v1.3.0
type Filter func(msg interface{}) bool
Filter is a function to filter out messages before they reach a subscriptions primary Handler
type Handler ¶ added in v1.3.0
type Handler func(msg interface{}) bool
Handler is the function executed against the inbound message in a subscription
type PubSub ¶
type PubSub interface {
// Publish publishes the object to the channel by name
Publish(channel string, obj interface{}) error
// Subscribe subscribes to the given channel until the context is cancelled.
Subscribe(ctx context.Context, channel string, handler Handler, opts ...SubOpt) error
// Close closes all subscriptions
Close()
}
PubSub is used to asynchronously pass messages between routines.
type SubOpt ¶ added in v1.4.0
type SubOpt func(options *SubOptions)
func WithFilter ¶ added in v1.4.0
type SubOptions ¶ added in v1.4.0
type SubOptions struct {
// contains filtered or unexported fields
}