Documentation
¶
Index ¶
- Constants
- type ActionPayload
- type Query
- func (q *Query) Actions() []*action.Entity
- func (q *Query) GetActionType(a action.Action) (action.Type, error)
- func (q *Query) GetActionWorkers(actionName action.Action) ([]*worker.Entity, error)
- func (q *Query) GetNextStateAndAction(current state.State, event string) (action.Action, state.State, error)
- func (q *Query) IsActionValid(a *action.Action) bool
- func (q *Query) IsStateValid(s *state.State) bool
- func (q *Query) Project() project.Entity
- func (q *Query) States() []*state.State
- func (q *Query) Transitions() []*transition.Entity
- type QueryBuilder
- type Repository
- type TransitionPayload
- type WorkFlow
- func (wf *WorkFlow) BuildActions(ctx context.Context, projectCreated project.Persistent, ...) error
- func (wf *WorkFlow) BuildProject(ctx context.Context, projectName, activityName string) (project.Persistent, error)
- func (wf *WorkFlow) BuildStates(ctx context.Context, projectCreated project.Persistent, states []state.State) error
- func (wf *WorkFlow) BuildTransitions(ctx context.Context, projectCreated project.Persistent, ...) error
- func (wf *WorkFlow) BuildWorkers(ctx context.Context, projectName, activity string, workers []WorkerPayload) error
- func (wf *WorkFlow) Load(ctx context.Context, projectName, activityName string) (QueryBuilder, error)
- type WorkFlowAggregateBuilder
- type WorkerPayload
Constants ¶
View Source
const ( ProjectEntityCreated domain.Event = "project_entity_created" ProjectSaved domain.Event = "project_saved" StateEntitiesCreated domain.Event = "state_entities_created" StatesSaved domain.Event = "states_saved" ActionEntitiesCreated domain.Event = "action_entities_created" ActionsSaved domain.Event = "actions_saved" TransitionEntitiesCreated domain.Event = "transition_entities_created" TransitionsSaved domain.Event = "transitions_saved" WorkersSaved domain.Event = "workers_saved" WorkFlowLoaded domain.Event = "workflow_onload" )
a list of domain events triggered inside the workflow's aggregate
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionPayload ¶
ActionPayload used as bridge from the outside world to request an action's entity domain model
type Query ¶
func (*Query) GetActionWorkers ¶
func (*Query) GetNextStateAndAction ¶
func (*Query) Transitions ¶
func (q *Query) Transitions() []*transition.Entity
type QueryBuilder ¶
type QueryBuilder interface { Project() project.Entity States() []*state.State Actions() []*action.Entity Transitions() []*transition.Entity IsStateValid(s *state.State) bool IsActionValid(a *action.Action) bool GetActionType(a action.Action) (action.Type, error) GetNextStateAndAction(current state.State, event string) (action.Action, state.State, error) GetActionWorkers(actionName action.Action) ([]*worker.Entity, error) }
type Repository ¶
type Repository interface { CreateProject(ctx context.Context, payload project.Persistent) (project.Persistent, error) CreateBulkStates(ctx context.Context, payload []state.Persistent) error CreateBulkActions(ctx context.Context, payload []action.Persistent) error CreateBulkTransitions(ctx context.Context, payload []transition.Persistent) error CreateBulkWorkers(ctx context.Context, payload []worker.Persistent) error GetProject(ctx context.Context, projectName, activityName string) (*project.Persistent, error) GetStates(ctx context.Context, projectUID string) ([]*state.Persistent, error) GetActions(ctx context.Context, projectUID string) ([]*action.Persistent, error) GetTransitions(ctx context.Context, projectUID string) ([]*transition.Persistent, error) GetWorkers(ctx context.Context, projectUID string) ([]*worker.Persistent, error) }
type TransitionPayload ¶
type TransitionPayload struct { Current string `json:"current"` Event string `json:"event"` Action string `json:"action"` Next string `json:"next"` }
TransitionPayload used as a bridge from the outside world to request a transition's entity domain model
type WorkFlow ¶
WorkFlow is an aggregate root which contains states, actions and transitions. This aggregate used as main entry point to manage our domain models
func NewWorkFlow ¶
func NewWorkFlow(repo Repository) *WorkFlow
NewWorkFlow used as WorkFlow's aggregate constructor
func (*WorkFlow) BuildActions ¶
func (wf *WorkFlow) BuildActions(ctx context.Context, projectCreated project.Persistent, payload []ActionPayload) error
BuildActions used to create multiple actions
func (*WorkFlow) BuildProject ¶
func (wf *WorkFlow) BuildProject(ctx context.Context, projectName, activityName string) (project.Persistent, error)
BuildProject used to create a project
func (*WorkFlow) BuildStates ¶
func (wf *WorkFlow) BuildStates(ctx context.Context, projectCreated project.Persistent, states []state.State) error
BuildStates used to create multiple states
func (*WorkFlow) BuildTransitions ¶
func (wf *WorkFlow) BuildTransitions(ctx context.Context, projectCreated project.Persistent, payload []TransitionPayload) error
BuildTransitions used to create multiple transitions
func (*WorkFlow) BuildWorkers ¶
type WorkFlowAggregateBuilder ¶
type WorkFlowAggregateBuilder interface { BuildProject(ctx context.Context, projectName, activityName string) (project.Persistent, error) BuildStates(ctx context.Context, projectCreated project.Persistent, states []state.State) error BuildActions(ctx context.Context, projectCreated project.Persistent, payload []ActionPayload) error BuildTransitions(ctx context.Context, projectCreated project.Persistent, payload []TransitionPayload) error BuildWorkers(ctx context.Context, projectName, activity string, workers []WorkerPayload) error Load(ctx context.Context, projectName, activityName string) (QueryBuilder, error) }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.