Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- type Task
- func (t *Task) AppendError(err error)
- func (t *Task) ClearError()
- func (t *Task) HasError() bool
- func (t *Task) IsCompleted() bool
- func (t *Task) IsFailed() bool
- func (t *Task) Normalize(normalizer structure.Normalizer)
- func (t *Task) Parse(parser structure.ObjectParser)
- func (t *Task) RepeatAvailableAfter(availableDuration time.Duration)
- func (t *Task) RepeatAvailableAt(availableTime time.Time)
- func (t *Task) Sanitize(details request.Details) error
- func (t *Task) SetCompleted()
- func (t *Task) SetFailed()
- func (t *Task) Validate(validator structure.Validator)
- type TaskAccessor
- type TaskCreate
- type TaskFilter
- type TaskUpdate
- type Tasks
Constants ¶
View Source
const ( TaskStatePending = "pending" TaskStateRunning = "running" TaskStateFailed = "failed" TaskStateCompleted = "completed" )
Variables ¶
View Source
var TaskStates = []string{TaskStatePending, TaskStateRunning, TaskStateFailed, TaskStateCompleted}
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { TaskAccessor }
type Task ¶
type Task struct { ID string `json:"id,omitempty" bson:"id,omitempty"` Name *string `json:"name,omitempty" bson:"name,omitempty"` Type string `json:"type,omitempty" bson:"type,omitempty"` Priority int `json:"priority,omitempty" bson:"priority,omitempty"` Data map[string]interface{} `json:"data,omitempty" bson:"data,omitempty"` AvailableTime *time.Time `json:"availableTime,omitempty" bson:"availableTime,omitempty"` ExpirationTime *time.Time `json:"expirationTime,omitempty" bson:"expirationTime,omitempty"` State string `json:"state,omitempty" bson:"state,omitempty"` Error *errors.Serializable `json:"error,omitempty" bson:"error,omitempty"` RunTime *time.Time `json:"runTime,omitempty" bson:"runTime,omitempty"` Duration *float64 `json:"duration,omitempty" bson:"duration,omitempty"` CreatedTime time.Time `json:"createdTime,omitempty" bson:"createdTime,omitempty"` ModifiedTime *time.Time `json:"modifiedTime,omitempty" bson:"modifiedTime,omitempty"` }
func NewTask ¶
func NewTask(create *TaskCreate) (*Task, error)
func (*Task) AppendError ¶
func (*Task) ClearError ¶
func (t *Task) ClearError()
func (*Task) IsCompleted ¶
func (*Task) Normalize ¶
func (t *Task) Normalize(normalizer structure.Normalizer)
func (*Task) Parse ¶
func (t *Task) Parse(parser structure.ObjectParser)
func (*Task) RepeatAvailableAfter ¶
func (*Task) RepeatAvailableAt ¶
func (*Task) SetCompleted ¶
func (t *Task) SetCompleted()
type TaskAccessor ¶
type TaskAccessor interface { ListTasks(ctx context.Context, filter *TaskFilter, pagination *page.Pagination) (Tasks, error) CreateTask(ctx context.Context, create *TaskCreate) (*Task, error) GetTask(ctx context.Context, id string) (*Task, error) UpdateTask(ctx context.Context, id string, update *TaskUpdate) (*Task, error) DeleteTask(ctx context.Context, id string) error }
type TaskCreate ¶
type TaskCreate struct { Name *string `json:"name,omitempty"` Type string `json:"type,omitempty"` Priority int `json:"priority,omitempty"` Data map[string]interface{} `json:"data,omitempty"` AvailableTime *time.Time `json:"availableTime,omitempty"` ExpirationTime *time.Time `json:"expirationTime,omitempty"` }
func NewTaskCreate ¶
func NewTaskCreate() *TaskCreate
func (*TaskCreate) Parse ¶
func (t *TaskCreate) Parse(parser structure.ObjectParser)
func (*TaskCreate) Validate ¶
func (t *TaskCreate) Validate(validator structure.Validator)
type TaskFilter ¶
type TaskFilter struct { Name *string `json:"name,omitempty"` Type *string `json:"type,omitempty"` State *string `json:"state,omitempty"` }
func NewTaskFilter ¶
func NewTaskFilter() *TaskFilter
func (*TaskFilter) Parse ¶
func (t *TaskFilter) Parse(parser structure.ObjectParser)
func (*TaskFilter) Validate ¶
func (t *TaskFilter) Validate(validator structure.Validator)
type TaskUpdate ¶
type TaskUpdate struct { Priority *int `json:"priority,omitempty" bson:"priority,omitempty"` Data *map[string]interface{} `json:"data,omitempty" bson:"data,omitempty"` AvailableTime *time.Time `json:"availableTime,omitempty" bson:"availableTime,omitempty"` ExpirationTime *time.Time `json:"expirationTime,omitempty" bson:"expirationTime,omitempty"` }
func NewTaskUpdate ¶
func NewTaskUpdate() *TaskUpdate
func (*TaskUpdate) HasUpdates ¶
func (t *TaskUpdate) HasUpdates() bool
func (*TaskUpdate) Parse ¶
func (t *TaskUpdate) Parse(parser structure.ObjectParser)
func (*TaskUpdate) Validate ¶
func (t *TaskUpdate) Validate(validator structure.Validator)
Click to show internal directories.
Click to hide internal directories.