mirror of
https://github.com/hibiken/asynq.git
synced 2025-09-19 05:17:30 +08:00
Change payload to byte slice
This commit is contained in:
19
asynq.go
19
asynq.go
@@ -17,20 +17,21 @@ import (
|
||||
|
||||
// Task represents a unit of work to be performed.
|
||||
type Task struct {
|
||||
// Type indicates the type of task to be performed.
|
||||
Type string
|
||||
// typename indicates the type of task to be performed.
|
||||
typename string
|
||||
|
||||
// Payload holds data needed to perform the task.
|
||||
Payload Payload
|
||||
// payload holds data needed to perform the task.
|
||||
payload []byte
|
||||
}
|
||||
|
||||
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.
|
||||
//
|
||||
// The payload values must be serializable.
|
||||
func NewTask(typename string, payload map[string]interface{}) *Task {
|
||||
func NewTask(typename string, payload []byte) *Task {
|
||||
return &Task{
|
||||
Type: typename,
|
||||
Payload: Payload{payload},
|
||||
typename: typename,
|
||||
payload: payload,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user