Documentation ¶
Index ¶
- type Action
- func (a *Action) Actions() []*Action
- func (a *Action) AddAction(actions ...*Action) error
- func (a *Action) Context() context.Context
- func (a *Action) Execute() (err error)
- func (a *Action) ExecuteContext(ctx context.Context) (err error)
- func (a *Action) Find() *Action
- func (a *Action) HasParent() bool
- func (a *Action) HasSubActions() bool
- func (a *Action) Parent() *Action
- func (a *Action) RemoveAction(actions ...*Action)
- func (a *Action) Root() *Action
- func (a *Action) Runnable() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { // Name action's name Name string // The *Run functions are executed in the following order: // * PersistentPreRun() // * PreRun() // * Run() // * PostRun() // * PersistentPostRun() // All functions get the same args. // // PersistentPreRun: children of this action will inherit and execute. PersistentPreRun func(act *Action) error // PreRun: children of this action will not inherit. PreRun func(act *Action) error // Run: Typically the actual work function. Most actions will only implement this. Run func(act *Action) error // PostRun: run after the Run action. PostRun func(act *Action) error // PersistentPostRun: children of this action will inherit and execute after PostRun. PersistentPostRun func(act *Action) error // Executable: whether is an executable action. Executable func(act *Action) bool // contains filtered or unexported fields }
Action is just that, an action for your application.
func (*Action) Context ¶
Context returns underlying action context. If action wasn't executed with ExecuteContext Context returns Background context.
func (*Action) ExecuteContext ¶
ExecuteContext is the same as Execute(), but sets the ctx on the action.
func (*Action) HasSubActions ¶
HasSubActions determines if the Action has children actions.
func (*Action) RemoveAction ¶
RemoveAction removes one or more actions from a parent action.
Click to show internal directories.
Click to hide internal directories.