Documentation ¶
Index ¶
Constants ¶
View Source
const ( Halt = iota Rest Work Tare Wait )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractState ¶
type AbstractState interface { GetType() WorkoutStateType GetMutableState() MutableState // contains filtered or unexported methods }
type ActualInput ¶
type ActualInput interface { UserInput Satisfies(input ExpectedInput) bool }
type AutoRefreshingModel ¶
type ExpectedInput ¶
type ExpectedInput interface { UserInput }
type ExpiringState ¶
type ExpiringState interface { AbstractState Deadline() time.Time Fallback() State }
type InputDependentState ¶
type InputDependentState interface { AbstractState InputRequired() ExpectedInput InputReceived() ActualInput // TODO(rchew): make Satisfied return read-once channel and add an evolving state Satisfied() bool }
type MutableState ¶
type State ¶
type State interface { AbstractState // TODO(rchew) better to just do this with casting? ExpiringState() (ExpiringState, bool) InputDependentState() (InputDependentState, bool) }
func NewState ¶
func NewState(stateType WorkoutStateType, opts ...StateBuilderOption) State
type StateBuilderOption ¶
type StateBuilderOption interface {
// contains filtered or unexported methods
}
func WithExpectedUserInput ¶
func WithExpectedUserInput(expected ExpectedInput, actual ActualInput) StateBuilderOption
func WithExpiryAndFallback ¶
func WithExpiryAndFallback(deadline time.Time, fallback State) StateBuilderOption
type UserInput ¶
type UserInput interface {
GetValue() UserInputValue
}
type UserInputValue ¶
type WorkoutStateType ¶
type WorkoutStateType int
func (WorkoutStateType) String ¶
func (t WorkoutStateType) String() string
Click to show internal directories.
Click to hide internal directories.