add helper for publish options

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-10-10 00:47:09 +03:00
parent 2fc47782cf
commit 0e1f744fcc

View File

@ -45,6 +45,18 @@ type PublishOptions struct {
Context context.Context Context context.Context
} }
func NewPublishOptions(opts ...PublishOption) PublishOptions {
opt := PublishOptions{
Context: context.Background(),
}
for _, o := range opts {
o(&opt)
}
return opt
}
type SubscribeOptions struct { type SubscribeOptions struct {
// AutoAck ack messages if handler returns nil err // AutoAck ack messages if handler returns nil err
AutoAck bool AutoAck bool