mirror of
https://github.com/hibiken/asynq.git
synced 2026-06-25 16:33:03 +08:00
feat: Add an option to create headers from a map
This commit is contained in:
@@ -234,6 +234,13 @@ func (h headerOption) String() string {
|
||||
func (h headerOption) Type() OptionType { return HeaderOpt }
|
||||
func (h headerOption) Value() interface{} { return [2]string{h[0], h[1]} }
|
||||
|
||||
func Headers(headers map[string]string) (ret []Option) {
|
||||
for key, value := range headers {
|
||||
ret = append(ret, Header(key, value))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ErrDuplicateTask indicates that the given task could not be enqueued since it's a duplicate of another task.
|
||||
//
|
||||
// ErrDuplicateTask error only applies to tasks enqueued with a Unique option.
|
||||
|
||||
Reference in New Issue
Block a user