Documentation
¶
Index ¶
Constants ¶
View Source
const (
FinishReasonTimeout = "timeout"
)
Variables ¶
View Source
var ( ErrTaskTypeNotFound = errors.New("task type not found") ErrTaskAlreadyExists = errors.New("task already exists") ErrTaskNotFound = errors.New("task not found") )
View Source
var ( WithTaskName = func(name string) CreateOption { return func(t *Task) { t.Name = name } } WithTimeout = func(timeout int64) CreateOption { return func(t *Task) { t.Timeout = timeout } } WithId = func(id string) CreateOption { return func(t *Task) { t.Id = id } } UniqueTask = func(unique ...bool) CreateOption { return func(t *Task) { if len(unique) > 0 { t.Unique = unique[0] } else { t.Unique = true } } } WithMeta = func(meta map[string]any) CreateOption { return func(t *Task) { t.Meta = meta } } )
Functions ¶
func RegisterHandler ¶
Types ¶
type CreateOption ¶
type CreateOption func(t *Task)
type Task ¶
type Task struct {
Name string `json:"name"`
Id string `json:"id"`
Type string `json:"type"`
Status Status `json:"status"`
CreatedAt int64 `json:"created_at"`
FinishedAt int64 `json:"finished_at"`
FinishReason string `json:"finish_reason"`
Timeout int64 `json:"timeout"` // second, default 30
Unique bool `json:"unique"`
Meta map[string]any `json:"meta"`
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.