Documentation
¶
Index ¶
- type Service
- func (s *Service) GetBlockSwitchedOn(ctx context.Context, t blockcommand.BlockType) (string, error)
- func (s *Service) GetBlocks(ctx context.Context) ([]blockcommand.Block, error)
- func (s *Service) RemoveAllBlocks(ctx context.Context) error
- func (s *Service) SwitchBlockOff(ctx context.Context, t blockcommand.BlockType) error
- func (s *Service) SwitchBlockOn(ctx context.Context, t blockcommand.BlockType, message string) error
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service defines a service for interacting with the underlying state.
func NewService ¶
NewService returns a new Service for interacting with the underlying state.
func (*Service) GetBlockSwitchedOn ¶
GetBlockSwitchedOn returns the optional block message if it is switched on for the given type. Returns an error errors.NotFound if the block does not exist.
func (*Service) RemoveAllBlocks ¶
RemoveAllBlocks removes all the blocks for the current model.
func (*Service) SwitchBlockOff ¶
SwitchBlockOff disables block of specified type for the current model. Returns an error errors.NotFound if the block does not exist.
func (*Service) SwitchBlockOn ¶
func (s *Service) SwitchBlockOn(ctx context.Context, t blockcommand.BlockType, message string) error
SwitchBlockOn switches on a command block for a given type and message. Returns an error errors.AlreadyExists if the block already exists.
type State ¶
type State interface { // SetBlock switches on a command block for a given type with an optional // message. SetBlock(ctx context.Context, t blockcommand.BlockType, message string) error // RemoveBlock disables block of specified type for the current model. RemoveBlock(ctx context.Context, t blockcommand.BlockType) error // RemoveAllBlocks removes all the blocks for the current model. RemoveAllBlocks(ctx context.Context) error // GetBlocks returns all the blocks for the current model. GetBlocks(ctx context.Context) ([]blockcommand.Block, error) // GetBlockMessage returns the optional block message if it is switched on. GetBlockMessage(ctx context.Context, t blockcommand.BlockType) (string, error) }
State defines an interface for interacting with the underlying state.