Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultDuration = 25 * time.Minute
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvailableAction ¶
type AvailableAction int
const ( AvailableActionStart AvailableAction = iota AvailableActionPause AvailableActionResume AvailableActionStop AvailableActionSwitch )
func (AvailableAction) String ¶
func (i AvailableAction) String() string
type InvalidStatusTransition ¶
type InvalidStatusTransition struct {
// contains filtered or unexported fields
}
func NewInvalidStatusTransition ¶
func NewInvalidStatusTransition(msg string) *InvalidStatusTransition
func (*InvalidStatusTransition) Error ¶
func (e *InvalidStatusTransition) Error() string
type Repository ¶
type Status ¶
type Status interface { Value() StatusValue Update(to Status) error }
func NewStatus ¶
func NewStatus(s StatusValue) Status
func NewStatusFromString ¶
type StatusValue ¶
type StatusValue string
const ( TaskStatusNone StatusValue = "none" TaskStatusRunning StatusValue = "running" TaskStatusPaused StatusValue = "paused" TaskStatusStopped StatusValue = "aborted" TaskStatusFinished StatusValue = "finished" )
type Task ¶
type Task interface { // props Name() Name Duration() Duration StartedAt() StartedAt Elapsed() Elapsed Status() Status AvailableActions() []AvailableAction // behaviors Start(at time.Time) error Pause() error Resume(at time.Time) error Stop() error Finish() error CanStart() bool CanPause() bool CanResume() bool CanStop() bool CanFinish() bool }
type TaskFinished ¶
type TaskFinished interface { event.Event Name() Name StartedAt() StartedAt Duration() Duration Elapsed() Elapsed Status() Status }
func NewTaskFinished ¶
type TaskPaused ¶
type TaskPaused interface { event.Event Name() Name StartedAt() StartedAt Duration() Duration Elapsed() Elapsed Status() Status }
func NewTaskPaused ¶
type TaskResumed ¶
type TaskResumed interface { event.Event Name() Name StartedAt() StartedAt Duration() Duration Elapsed() Elapsed Status() Status }
func NewTaskResumed ¶
type TaskService ¶
func NewTaskService ¶
func NewTaskService(repository Repository) TaskService
type TaskStarted ¶
type TaskStarted interface { event.Event Name() Name StartedAt() StartedAt Duration() Duration Elapsed() Elapsed }
func NewTaskStarted ¶
func NewTaskStarted(name Name, startedAt StartedAt, duration Duration, elapsed Elapsed) TaskStarted
Click to show internal directories.
Click to hide internal directories.