Documentation ¶
Index ¶
- Constants
- func ReadCategory(data []byte) (flows.Category, error)
- func ReadRouter(data json.RawMessage) (flows.Router, error)
- func RegisteredTypes() []string
- type Case
- type Category
- type RandomRouter
- func (r *RandomRouter) AllowTimeout() bool
- func (r *RandomRouter) Categories() []flows.Category
- func (r *RandomRouter) EnumerateDependencies(localization flows.Localization, include func(envs.Language, assets.Reference))
- func (r *RandomRouter) EnumerateLocalizables(include func(uuids.UUID, string, []string, func([]string)))
- func (r *RandomRouter) EnumerateResults(include func(*flows.ResultInfo))
- func (r *RandomRouter) EnumerateTemplates(localization flows.Localization, include func(envs.Language, string))
- func (r *RandomRouter) MarshalJSON() ([]byte, error)
- func (r *RandomRouter) ResultName() string
- func (r *RandomRouter) Route(run flows.Run, step flows.Step, logEvent flows.EventCallback) (flows.ExitUUID, string, error)
- func (r *RandomRouter) RouteTimeout(run flows.Run, step flows.Step, logEvent flows.EventCallback) (flows.ExitUUID, error)
- func (r *RandomRouter) Type() string
- func (r *RandomRouter) Validate(flow flows.Flow, exits []flows.Exit) error
- func (r *RandomRouter) Wait() flows.Wait
- type SwitchRouter
- func (r *SwitchRouter) AllowTimeout() bool
- func (r *SwitchRouter) Cases() []*Case
- func (r *SwitchRouter) Categories() []flows.Category
- func (r *SwitchRouter) EnumerateDependencies(localization flows.Localization, include func(envs.Language, assets.Reference))
- func (r *SwitchRouter) EnumerateLocalizables(include func(uuids.UUID, string, []string, func([]string)))
- func (r *SwitchRouter) EnumerateResults(include func(*flows.ResultInfo))
- func (r *SwitchRouter) EnumerateTemplates(localization flows.Localization, include func(envs.Language, string))
- func (r *SwitchRouter) MarshalJSON() ([]byte, error)
- func (r *SwitchRouter) ResultName() string
- func (r *SwitchRouter) Route(run flows.Run, step flows.Step, logEvent flows.EventCallback) (flows.ExitUUID, string, error)
- func (r *SwitchRouter) RouteTimeout(run flows.Run, step flows.Step, logEvent flows.EventCallback) (flows.ExitUUID, error)
- func (r *SwitchRouter) Type() string
- func (r *SwitchRouter) Validate(flow flows.Flow, exits []flows.Exit) error
- func (r *SwitchRouter) Wait() flows.Wait
Constants ¶
const TypeRandom string = "random"
TypeRandom is the type for a random router
const TypeSwitch string = "switch"
TypeSwitch is the constant for our switch router
Variables ¶
This section is empty.
Functions ¶
func ReadCategory ¶
ReadCategory unmarshals a router category from the given JSON
func ReadRouter ¶
func ReadRouter(data json.RawMessage) (flows.Router, error)
ReadRouter reads a router from the given JSON
func RegisteredTypes ¶
func RegisteredTypes() []string
RegisteredTypes gets the registered types of router
Types ¶
type Case ¶
type Case struct { UUID uuids.UUID `json:"uuid" validate:"required"` Type string `json:"type" validate:"required"` Arguments []string `json:"arguments,omitempty" engine:"localized,evaluated"` CategoryUUID flows.CategoryUUID `json:"category_uuid" validate:"required"` }
Case represents a single case and test in our switch
func NewCase ¶
func NewCase(uuid uuids.UUID, type_ string, arguments []string, categoryUUID flows.CategoryUUID) *Case
NewCase creates a new case
func (*Case) Dependencies ¶
func (c *Case) Dependencies(localization flows.Localization, include func(envs.Language, assets.Reference))
Dependencies enumerates the dependencies on this case
func (*Case) LocalizationUUID ¶
LocalizationUUID gets the UUID which identifies this object for localization
type Category ¶
type Category struct {
// contains filtered or unexported fields
}
func NewCategory ¶
NewCategory creates a new category
func (*Category) LocalizationUUID ¶
LocalizationUUID gets the UUID which identifies this object for localization
func (*Category) MarshalJSON ¶
MarshalJSON marshals this node category into JSON
func (*Category) UUID ¶
func (c *Category) UUID() flows.CategoryUUID
type RandomRouter ¶
type RandomRouter struct {
// contains filtered or unexported fields
}
RandomRouter is a router which will exit out a random exit
func (*RandomRouter) AllowTimeout ¶
func (r *RandomRouter) AllowTimeout() bool
AllowTimeout returns whether this router can be resumed at with a timeout
func (*RandomRouter) Categories ¶
Categories returns the categories on this router
func (*RandomRouter) EnumerateDependencies ¶
func (r *RandomRouter) EnumerateDependencies(localization flows.Localization, include func(envs.Language, assets.Reference))
EnumerateDependencies enumerates all dependencies on this object
func (*RandomRouter) EnumerateLocalizables ¶
func (r *RandomRouter) EnumerateLocalizables(include func(uuids.UUID, string, []string, func([]string)))
EnumerateLocalizables enumerates all the localizable text on this object
func (*RandomRouter) EnumerateResults ¶
func (r *RandomRouter) EnumerateResults(include func(*flows.ResultInfo))
EnumerateResults enumerates all potential results on this object
func (*RandomRouter) EnumerateTemplates ¶
func (r *RandomRouter) EnumerateTemplates(localization flows.Localization, include func(envs.Language, string))
EnumerateTemplates enumerates all expressions on this object and its children
func (*RandomRouter) MarshalJSON ¶
func (r *RandomRouter) MarshalJSON() ([]byte, error)
MarshalJSON marshals this resume into JSON
func (*RandomRouter) ResultName ¶
func (r *RandomRouter) ResultName() string
ResultName returns the name which the result of this router should be saved as (if any)
func (*RandomRouter) Route ¶
func (r *RandomRouter) Route(run flows.Run, step flows.Step, logEvent flows.EventCallback) (flows.ExitUUID, string, error)
Route determines which exit to take from a node
func (*RandomRouter) RouteTimeout ¶
func (r *RandomRouter) RouteTimeout(run flows.Run, step flows.Step, logEvent flows.EventCallback) (flows.ExitUUID, error)
RouteTimeout routes in the case that this router's wait timed out
func (*RandomRouter) Type ¶
func (r *RandomRouter) Type() string
Type returns the type of this router
type SwitchRouter ¶
type SwitchRouter struct {
// contains filtered or unexported fields
}
SwitchRouter is a router which allows specifying 0-n cases which should each be tested in order, following whichever case returns true, or if none do, then taking the default category
func NewSwitch ¶
func NewSwitch(wait flows.Wait, resultName string, categories []flows.Category, operand string, cases []*Case, defaultCategoryUUID flows.CategoryUUID) *SwitchRouter
NewSwitch creates a new switch router
func (*SwitchRouter) AllowTimeout ¶
func (r *SwitchRouter) AllowTimeout() bool
AllowTimeout returns whether this router can be resumed at with a timeout
func (*SwitchRouter) Cases ¶
func (r *SwitchRouter) Cases() []*Case
Cases returns the cases for this switch router
func (*SwitchRouter) Categories ¶
Categories returns the categories on this router
func (*SwitchRouter) EnumerateDependencies ¶
func (r *SwitchRouter) EnumerateDependencies(localization flows.Localization, include func(envs.Language, assets.Reference))
EnumerateDependencies enumerates all dependencies on this object and its children
func (*SwitchRouter) EnumerateLocalizables ¶
func (r *SwitchRouter) EnumerateLocalizables(include func(uuids.UUID, string, []string, func([]string)))
EnumerateLocalizables enumerates all the localizable text on this object
func (*SwitchRouter) EnumerateResults ¶
func (r *SwitchRouter) EnumerateResults(include func(*flows.ResultInfo))
EnumerateResults enumerates all potential results on this object
func (*SwitchRouter) EnumerateTemplates ¶
func (r *SwitchRouter) EnumerateTemplates(localization flows.Localization, include func(envs.Language, string))
EnumerateTemplates enumerates all expressions on this object and its children
func (*SwitchRouter) MarshalJSON ¶
func (r *SwitchRouter) MarshalJSON() ([]byte, error)
MarshalJSON marshals this resume into JSON
func (*SwitchRouter) ResultName ¶
func (r *SwitchRouter) ResultName() string
ResultName returns the name which the result of this router should be saved as (if any)
func (*SwitchRouter) Route ¶
func (r *SwitchRouter) Route(run flows.Run, step flows.Step, logEvent flows.EventCallback) (flows.ExitUUID, string, error)
Route determines which exit to take from a node
func (*SwitchRouter) RouteTimeout ¶
func (r *SwitchRouter) RouteTimeout(run flows.Run, step flows.Step, logEvent flows.EventCallback) (flows.ExitUUID, error)
RouteTimeout routes in the case that this router's wait timed out
func (*SwitchRouter) Type ¶
func (r *SwitchRouter) Type() string
Type returns the type of this router