2
0
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:
kayoch1n
2026-03-17 14:47:34 +08:00
parent dbfdfbac5a
commit 5216f1c3be

View File

@@ -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.