Versions in this module Expand all Collapse all v0 v0.0.3 Jan 22, 2025 Changes in this version + type Map map[string]IQueue + func (m Map) String() string + func (m Map) ToSlice() []IQueue type PublishParams + Any any type SubscribeParams + Any any v0.0.2 Jan 22, 2025 v0.0.1 Jan 22, 2025 Changes in this version + const DefaultMetricCounterLabel + const Type + var ErrRequiredPostHook = customerror.NewRequiredError("post-hook function", customerror.WithErrorCode("ERR_REQUIRED_POST_HOOK")) + var ErrRequiredPreHook = customerror.NewRequiredError("pre-hook function", customerror.WithErrorCode("ERR_REQUIRED_PRE_HOOK")) + func Flatten2D[T any](data [][]T) []T + func NewMap[P, S any]() map[string]IQueue[P, S] + func ParseToStruct(from, to any) error + func PublishMany[P, S any](ctx context.Context, q IQueue[P, S], queueName string, items []*Message, ...) error + func PublishToMany[P, S any](ctx context.Context, m map[string]IQueue[P, S], queueName string, msg *Message, ...) error + func Publish[P any, S any](ctx context.Context, s IQueue[P, S], queueName string, msg *Message, prm *P, ...) error + func String[P, S any](m map[string]IQueue[P, S]) string + func Subscribe[P any, S any](ctx context.Context, s IQueue[P, S], queueName string, cb CallbackFunc, prm *S, ...) error + type CallbackFunc func(ctx context.Context, msg *Message) error + type HookFunc func(ctx context.Context, q IQueue[P, S], queueName string, m *Message) error + type IQueue interface + GetClient func() any + GetCounterPublished func() *expvar.Int + GetCounterPublishedFailed func() *expvar.Int + GetCounterReceived func() *expvar.Int + GetCounterReceivedFailed func() *expvar.Int + GetCounterSubscribed func() *expvar.Int + GetCounterSubscribedFailed func() *expvar.Int + GetLogger func() sypl.ISypl + GetName func() string + GetType func() string + Publish func(ctx context.Context, queueName string, msg *Message, prm *P, ...) error + Subscribe func(ctx context.Context, queueName string, cb CallbackFunc, prm *S, ...) error + func ToSlice[P, S any](m map[string]IQueue[P, S]) []IQueue[P, S] + type Message struct + Body []byte + MessageID string + Metadata map[string]interface{} + Timestamp time.Time + func NewMessage(body []byte) *Message + func NewMessageFromStruct(body any) (*Message, error) + func NewMustMessageFromStruct(body any) *Message + type Mock struct + MockGetClient func() any + MockGetCounterPublished func() *expvar.Int + MockGetCounterPublishedFailed func() *expvar.Int + MockGetCounterReceived func() *expvar.Int + MockGetCounterReceivedFailed func() *expvar.Int + MockGetCounterSubscribed func() *expvar.Int + MockGetCounterSubscribedFailed func() *expvar.Int + MockGetLogger func() sypl.ISypl + MockGetName func() string + MockGetType func() string + MockPublish func(ctx context.Context, queueName string, msg *Message, prm *P, ...) error + MockSubscribe func(ctx context.Context, queueName string, cb CallbackFunc, prm *S, ...) error + func (m *Mock[PublishParams, SubscribeParams]) GetClient() any + func (m *Mock[PublishParams, SubscribeParams]) GetCounterPublished() *expvar.Int + func (m *Mock[PublishParams, SubscribeParams]) GetCounterPublishedFailed() *expvar.Int + func (m *Mock[PublishParams, SubscribeParams]) GetCounterReceived() *expvar.Int + func (m *Mock[PublishParams, SubscribeParams]) GetCounterReceivedFailed() *expvar.Int + func (m *Mock[PublishParams, SubscribeParams]) GetCounterSubscribed() *expvar.Int + func (m *Mock[PublishParams, SubscribeParams]) GetCounterSubscribedFailed() *expvar.Int + func (m *Mock[PublishParams, SubscribeParams]) GetLogger() sypl.ISypl + func (m *Mock[PublishParams, SubscribeParams]) GetName() string + func (m *Mock[PublishParams, SubscribeParams]) GetType() string + func (m *Mock[PublishParams, SubscribeParams]) Publish(ctx context.Context, queueName string, msg *Message, prm *PublishParams, ...) error + func (m *Mock[PublishParams, SubscribeParams]) Subscribe(ctx context.Context, queueName string, cb CallbackFunc, prm *SubscribeParams, ...) error + type Operation string + const OperationPublished + const OperationReceived + const OperationSubscribed + func (o Operation) String() string + type Options struct + PostHookFunc HookFunc[P, S] + PreHookFunc HookFunc[P, S] + QueueName string + func NewOptions[P, S any]() (*Options[P, S], error) + type OptionsFunc func(o *Options[P, S]) error + func WithPostHook[P, S any](fn HookFunc[P, S]) OptionsFunc[P, S] + func WithPreHook[P, S any](fn HookFunc[P, S]) OptionsFunc[P, S] + func WithQueueName[P, S any](queueName string) OptionsFunc[P, S] + type PublishParams struct + DelaySeconds int + MessageGroupID string + Metadata map[string]interface{} + Priority int + Route string + Tags []string + type Queue struct + Logger sypl.ISypl + Name string + func New(ctx context.Context, name string) (*Queue, error) + func (s *Queue) GetCounterPublished() *expvar.Int + func (s *Queue) GetCounterPublishedFailed() *expvar.Int + func (s *Queue) GetCounterReceived() *expvar.Int + func (s *Queue) GetCounterReceivedFailed() *expvar.Int + func (s *Queue) GetCounterSubscribed() *expvar.Int + func (s *Queue) GetCounterSubscribedFailed() *expvar.Int + func (s *Queue) GetLogger() sypl.ISypl + func (s *Queue) GetName() string + func (s *Queue) GetType() string + type SubscribeParams struct + BatchSize int + ContextTimeout time.Duration + GroupID string + MaxMessages int + Metadata map[string]interface{} + Route string + Tags []string + WaitTimeout time.Duration