mirror of
https://github.com/hibiken/asynq.git
synced 2025-09-19 05:17:30 +08:00
Update NewTask function to take Option as varargs
This commit is contained in:
7
asynq.go
7
asynq.go
@@ -23,16 +23,21 @@ type Task struct {
|
||||
|
||||
// payload holds data needed to perform the task.
|
||||
payload []byte
|
||||
|
||||
// opts holds options for the task.
|
||||
opts []Option
|
||||
}
|
||||
|
||||
func (t *Task) Type() string { return t.typename }
|
||||
func (t *Task) Payload() []byte { return t.payload }
|
||||
|
||||
// NewTask returns a new Task given a type name and payload data.
|
||||
func NewTask(typename string, payload []byte) *Task {
|
||||
// Options can be passed to configure task processing behavior.
|
||||
func NewTask(typename string, payload []byte, opts ...Option) *Task {
|
||||
return &Task{
|
||||
typename: typename,
|
||||
payload: payload,
|
||||
opts: opts,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user