Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents a task queue.
func (*Queue) AddTask ¶
func (q *Queue) AddTask(exec func() (interface{}, error)) *TaskResult
AddTask adds a task to the queue and runs it.
type Task ¶
type Task struct { ID string Exec func() (interface{}, error) Status TaskStatus Error error CompletionTime time.Time }
Task represents a single task with an ID, a function to execute, status, error, and completion time.
type TaskResult ¶
type TaskResult struct { ID string `json:"id"` Status TaskStatus `json:"status"` Error error `json:"error"` CompletionTime time.Time `json:"completion_time"` Result interface{} `json:"result"` }
type TaskStatus ¶
type TaskStatus string
TaskStatus represents the status of a task.
const ( Pending TaskStatus = "pending" Success TaskStatus = "success" Error TaskStatus = "error" Archived TaskStatus = "archived" )
Click to show internal directories.
Click to hide internal directories.