Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotReceiver = errors.New("not implement receiver interface") ErrNotCommand = errors.New("not implement Command interface") ErrNotUndoCommand = errors.New("not implement UndoCommand interface") ErrNotRedoCommand = errors.New("not implement RedoCommand interface") )
var ( ErrNotFoundUndoCommand = errors.New("not found command in undo command stack") ErrNotFoundRedoCommand = errors.New("not found command in redo command stack") )
Functions ¶
This section is empty.
Types ¶
type CommandFunc ¶
The CommandFunc type is an adapter to allow the use of ordinary functions as Command. If f is a function with the appropriate signature, CommandFunc(f) is a Command that calls f.
type ConcreteCommand ¶
type ConcreteCommand struct {
// contains filtered or unexported fields
}
func NewConcreteCommand ¶
func NewConcreteCommand(receiver Receiver) *ConcreteCommand
type Handler ¶ added in v1.3.0
Handler is a command handler that to encapsulate a unit of processing work to be performed.
type Middleware ¶
type Middleware interface {
// Decorate wraps the underlying Command, adding some functionality.
Decorate(cmd Command) Command
}
Middleware allows us to write something like decorators to Command. It can execute something before Execute or after.
type MiddlewareFunc ¶
type MiddlewareFunc func(cmd Command) Command
The MiddlewareFunc type is an adapter to allow the use of ordinary functions as Middleware. If f is a function with the appropriate signature, MiddlewareFunc(f) is a Middleware that calls f.
func (MiddlewareFunc) Decorate ¶
func (f MiddlewareFunc) Decorate(cmd Command) Command
Decorate call f(cmd).
type RedoCommandFunc ¶
The RedoCommandFunc type is an adapter to allow the use of ordinary functions as RedoCommand. If f is a function with the appropriate signature, RedoCommandFunc(f) is a RedoCommand that calls f.
type RedoHandler ¶ added in v1.3.0
RedoHandler redo a Command
type RichCommand ¶
type RichCommand struct {
// contains filtered or unexported fields
}
func NewRichCommand ¶
func NewRichCommand(cmd Command, undoCmd UndoCommand, redoCmd RedoCommand) *RichCommand
type UndoCommandFunc ¶
The UndoCommandFunc type is an adapter to allow the use of ordinary functions as UndoCommand. If f is a function with the appropriate signature, UndoCommandFunc(f) is a UndoCommand that calls f.