Documentation ¶
Index ¶
- func AsAny(err error, targets ...any) bool
- func SubscribeMappedToMany[T any, U any](ctx context.Context, broker *Broker[T], ...) <-chan U
- type Broker
- func (b *Broker[T]) Publish(msg T)
- func (b *Broker[T]) Start(ctx context.Context, sub event.Subscription) error
- func (b *Broker[T]) Stop()
- func (b *Broker[T]) Subscribe() chan T
- func (b *Broker[T]) SubscribeWithCallback(ctx context.Context, callbackFn func(context.Context, T) error)
- func (b *Broker[T]) Unsubscribe(msgCh chan T)
- type CategorizedError
- type Map
- func (m *Map[K, V]) Delete(key K)
- func (m *Map[K, V]) Load(key K) (value V)
- func (m *Map[K, V]) LoadAndDelete(key K) (value V)
- func (m *Map[K, V]) LoadAndStore(key K, value V) V
- func (m *Map[K, V]) LoadOrStore(key K, value V) V
- func (m *Map[K, V]) Range(f func(key K, value V) bool)
- func (m *Map[K, V]) Store(key K, value V)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Broker ¶
type Broker[T any] struct { PubCh chan T // Input to broker // contains filtered or unexported fields }
func (*Broker[T]) SubscribeWithCallback ¶
func (b *Broker[T]) SubscribeWithCallback( ctx context.Context, callbackFn func(context.Context, T) error, )
Subscribes to a new channel mapped from `inCh` (one-to-one).
func (*Broker[T]) Unsubscribe ¶
func (b *Broker[T]) Unsubscribe(msgCh chan T)
type CategorizedError ¶
type CategorizedError[T comparable] struct { Cat T Err error }
func NewCategorizedError ¶
func NewCategorizedError[T comparable](cat T, err error) *CategorizedError[T]
func (*CategorizedError[T]) Category ¶
func (e *CategorizedError[T]) Category() T
func (*CategorizedError[T]) Error ¶
func (e *CategorizedError[T]) Error() string
func (*CategorizedError[T]) Is ¶
func (e *CategorizedError[T]) Is(target error) bool
Shallow comparison: categories must be equal.
func (*CategorizedError[T]) Unwrap ¶
func (e *CategorizedError[T]) Unwrap() error
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
sync.Map with type enforcement
func (*Map[K, V]) LoadAndDelete ¶
func (m *Map[K, V]) LoadAndDelete(key K) (value V)
func (*Map[K, V]) LoadAndStore ¶
func (m *Map[K, V]) LoadAndStore(key K, value V) V
func (*Map[K, V]) LoadOrStore ¶
func (m *Map[K, V]) LoadOrStore(key K, value V) V
Click to show internal directories.
Click to hide internal directories.