Documentation
¶
Overview ¶
Package action provides a mechanism for triggering arbitrary actions within handlers by encoding the actions to perform within Dogma messages.
Index ¶
- Variables
- func Map_Action_Behavior[T any](x *Action, caseFail func(string) T, caseLog func(string) T, ...) T
- func MustMap_Action_Behavior[T any](x *Action, caseFail func(string) T, caseLog func(string) T, ...) T
- func MustSwitch_Action_Behavior(x *Action, caseFail func(string), caseLog func(string), ...)
- func Run(s Scope, m Actionable) error
- func Switch_Action_Behavior(x *Action, caseFail func(string), caseLog func(string), ...)
- type Action
- func Destroy() []*Action
- func End() []*Action
- func ExecuteCommand(c dogma.Command) []*Action
- func Fail(message string) []*Action
- func Log(message string) []*Action
- func RecordEvent(e dogma.Message) []*Action
- func ScheduleTimeout(t dogma.Timeout, at time.Time) []*Action
- func Sequence(actions ...[]*Action) []*Action
- func (*Action) Descriptor() ([]byte, []int)deprecated
- func (x *Action) GetBehavior() isAction_Behavior
- func (x *Action) GetDestroy() *Empty
- func (x *Action) GetEnd() *Empty
- func (x *Action) GetExecuteCommand() *anypb.Any
- func (x *Action) GetFail() string
- func (x *Action) GetLog() string
- func (x *Action) GetRecordEvent() *anypb.Any
- func (x *Action) GetScheduleTimeout() *ScheduleTimeoutDetails
- func (*Action) ProtoMessage()
- func (x *Action) ProtoReflect() protoreflect.Message
- func (x *Action) Reset()
- func (x *Action) SetDestroy(v *Empty)
- func (x *Action) SetEnd(v *Empty)
- func (x *Action) SetExecuteCommand(v *anypb.Any)
- func (x *Action) SetFail(v string)
- func (x *Action) SetLog(v string)
- func (x *Action) SetRecordEvent(v *anypb.Any)
- func (x *Action) SetScheduleTimeout(v *ScheduleTimeoutDetails)
- func (x *Action) String() string
- func (x *Action) TryGetDestroy() (v *Empty, ok bool)
- func (x *Action) TryGetEnd() (v *Empty, ok bool)
- func (x *Action) TryGetExecuteCommand() (v *anypb.Any, ok bool)
- func (x *Action) TryGetFail() (v string, ok bool)
- func (x *Action) TryGetLog() (v string, ok bool)
- func (x *Action) TryGetRecordEvent() (v *anypb.Any, ok bool)
- func (x *Action) TryGetScheduleTimeout() (v *ScheduleTimeoutDetails, ok bool)
- type ActionBuilder
- func (b *ActionBuilder) Build() *Action
- func (b *ActionBuilder) From(x *Action) *ActionBuilder
- func (b *ActionBuilder) WithDestroy(v *Empty) *ActionBuilder
- func (b *ActionBuilder) WithEnd(v *Empty) *ActionBuilder
- func (b *ActionBuilder) WithExecuteCommand(v *anypb.Any) *ActionBuilder
- func (b *ActionBuilder) WithFail(v string) *ActionBuilder
- func (b *ActionBuilder) WithLog(v string) *ActionBuilder
- func (b *ActionBuilder) WithRecordEvent(v *anypb.Any) *ActionBuilder
- func (b *ActionBuilder) WithScheduleTimeout(v *ScheduleTimeoutDetails) *ActionBuilder
- type Action_Destroy
- type Action_End
- type Action_ExecuteCommand
- type Action_Fail
- type Action_Log
- type Action_RecordEvent
- type Action_ScheduleTimeout
- type Actionable
- type Empty
- type EmptyBuilder
- type ScheduleTimeoutDetails
- func (*ScheduleTimeoutDetails) Descriptor() ([]byte, []int)deprecated
- func (x *ScheduleTimeoutDetails) GetAt() *timestamppb.Timestamp
- func (x *ScheduleTimeoutDetails) GetTimeout() *anypb.Any
- func (*ScheduleTimeoutDetails) ProtoMessage()
- func (x *ScheduleTimeoutDetails) ProtoReflect() protoreflect.Message
- func (x *ScheduleTimeoutDetails) Reset()
- func (x *ScheduleTimeoutDetails) SetAt(v *timestamppb.Timestamp)
- func (x *ScheduleTimeoutDetails) SetTimeout(v *anypb.Any)
- func (x *ScheduleTimeoutDetails) String() string
- type ScheduleTimeoutDetailsBuilder
- func (b *ScheduleTimeoutDetailsBuilder) Build() *ScheduleTimeoutDetails
- func (b *ScheduleTimeoutDetailsBuilder) From(x *ScheduleTimeoutDetails) *ScheduleTimeoutDetailsBuilder
- func (b *ScheduleTimeoutDetailsBuilder) WithAt(v *timestamppb.Timestamp) *ScheduleTimeoutDetailsBuilder
- func (b *ScheduleTimeoutDetailsBuilder) WithTimeout(v *anypb.Any) *ScheduleTimeoutDetailsBuilder
- type Scope
Constants ¶
This section is empty.
Variables ¶
var File_github_com_dogmatiq_enginekit_enginetest_internal_action_action_proto protoreflect.FileDescriptor
Functions ¶
func Map_Action_Behavior ¶
func Map_Action_Behavior[T any]( x *Action, caseFail func(string) T, caseLog func(string) T, caseExecuteCommand func(*anypb.Any) T, caseRecordEvent func(*anypb.Any) T, caseScheduleTimeout func(*ScheduleTimeoutDetails) T, caseDestroy func(*Empty) T, caseEnd func(*Empty) T, none func() T, ) T
Map_Action_Behavior maps x.Behavior to a value of type T by invoking one of the given functions.
It invokes the function that corresponds to the value of x.Behavior, and returns that function's result. It calls none() if x.Behavior is nil.
func MustMap_Action_Behavior ¶ added in v0.10.3
func MustMap_Action_Behavior[T any]( x *Action, caseFail func(string) T, caseLog func(string) T, caseExecuteCommand func(*anypb.Any) T, caseRecordEvent func(*anypb.Any) T, caseScheduleTimeout func(*ScheduleTimeoutDetails) T, caseDestroy func(*Empty) T, caseEnd func(*Empty) T, ) T
MustMap_Action_Behavior maps x.Behavior to a value of type T by invoking one of the given functions.
It invokes the function that corresponds to the value of x.Behavior, and returns that function's result. It panics if x.Behavior is nil.
func MustSwitch_Action_Behavior ¶ added in v0.10.3
func MustSwitch_Action_Behavior( x *Action, caseFail func(string), caseLog func(string), caseExecuteCommand func(*anypb.Any), caseRecordEvent func(*anypb.Any), caseScheduleTimeout func(*ScheduleTimeoutDetails), caseDestroy func(*Empty), caseEnd func(*Empty), )
MustSwitch_Action_Behavior invokes one of the given functions based on the value of x.Behavior.
It panics if x.Behavior is nil.
func Run ¶
func Run( s Scope, m Actionable, ) error
Run runs the actions defined by m against the given scope.
func Switch_Action_Behavior ¶
func Switch_Action_Behavior( x *Action, caseFail func(string), caseLog func(string), caseExecuteCommand func(*anypb.Any), caseRecordEvent func(*anypb.Any), caseScheduleTimeout func(*ScheduleTimeoutDetails), caseDestroy func(*Empty), caseEnd func(*Empty), none func(), )
Switch_Action_Behavior invokes one of the given functions based on the value of x.Behavior.
It calls none() if x.Behavior is nil.
Types ¶
type Action ¶
type Action struct {
// Types that are valid to be assigned to Behavior:
//
// *Action_Fail
// *Action_Log
// *Action_ExecuteCommand
// *Action_RecordEvent
// *Action_ScheduleTimeout
// *Action_Destroy
// *Action_End
Behavior isAction_Behavior `protobuf_oneof:"behavior"`
// contains filtered or unexported fields
}
func Destroy ¶
func Destroy() []*Action
Destroy returns an action that causes the handler to destroy the aggregate instance.
func End ¶
func End() []*Action
End returns an action that causes the handler to end the process instance.
func ExecuteCommand ¶
ExecuteCommand returns an action that causes the handler to execute a command message.
func RecordEvent ¶
RecordEvent returns an action that causes the handler to record an event message.
func ScheduleTimeout ¶
ScheduleTimeout returns an action that causes the handler to schedule a timeout message.
func (*Action) Descriptor
deprecated
func (*Action) GetBehavior ¶
func (x *Action) GetBehavior() isAction_Behavior
func (*Action) GetDestroy ¶
func (*Action) GetExecuteCommand ¶
func (*Action) GetRecordEvent ¶
func (*Action) GetScheduleTimeout ¶
func (x *Action) GetScheduleTimeout() *ScheduleTimeoutDetails
func (*Action) ProtoMessage ¶
func (*Action) ProtoMessage()
func (*Action) ProtoReflect ¶
func (x *Action) ProtoReflect() protoreflect.Message
func (*Action) SetDestroy ¶
SetDestroy sets the x.Behavior field to a Action_Destroy value containing v, then returns x.
func (*Action) SetEnd ¶
SetEnd sets the x.Behavior field to a Action_End value containing v, then returns x.
func (*Action) SetExecuteCommand ¶
SetExecuteCommand sets the x.Behavior field to a Action_ExecuteCommand value containing v, then returns x.
func (*Action) SetFail ¶
SetFail sets the x.Behavior field to a Action_Fail value containing v, then returns x.
func (*Action) SetLog ¶
SetLog sets the x.Behavior field to a Action_Log value containing v, then returns x.
func (*Action) SetRecordEvent ¶
SetRecordEvent sets the x.Behavior field to a Action_RecordEvent value containing v, then returns x.
func (*Action) SetScheduleTimeout ¶
func (x *Action) SetScheduleTimeout(v *ScheduleTimeoutDetails)
SetScheduleTimeout sets the x.Behavior field to a Action_ScheduleTimeout value containing v, then returns x.
func (*Action) TryGetDestroy ¶ added in v0.10.3
TryGetDestroy returns x.Behavior.Destroy if x.Behavior is a Action_Destroy. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetEnd ¶ added in v0.10.3
TryGetEnd returns x.Behavior.End if x.Behavior is a Action_End. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetExecuteCommand ¶ added in v0.10.3
TryGetExecuteCommand returns x.Behavior.ExecuteCommand if x.Behavior is a Action_ExecuteCommand. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetFail ¶ added in v0.10.3
TryGetFail returns x.Behavior.Fail if x.Behavior is a Action_Fail. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetLog ¶ added in v0.10.3
TryGetLog returns x.Behavior.Log if x.Behavior is a Action_Log. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetRecordEvent ¶ added in v0.10.3
TryGetRecordEvent returns x.Behavior.RecordEvent if x.Behavior is a Action_RecordEvent. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetScheduleTimeout ¶ added in v0.10.3
func (x *Action) TryGetScheduleTimeout() (v *ScheduleTimeoutDetails, ok bool)
TryGetScheduleTimeout returns x.Behavior.ScheduleTimeout if x.Behavior is a Action_ScheduleTimeout. Otherwise, ok is false and v is the zero-value.
type ActionBuilder ¶
type ActionBuilder struct {
// contains filtered or unexported fields
}
func NewActionBuilder ¶
func NewActionBuilder() *ActionBuilder
NewActionBuilder returns a builder that constructs Action messages.
func (*ActionBuilder) Build ¶
func (b *ActionBuilder) Build() *Action
Build returns a new Action containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*ActionBuilder) From ¶
func (b *ActionBuilder) From(x *Action) *ActionBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
func (*ActionBuilder) WithDestroy ¶
func (b *ActionBuilder) WithDestroy(v *Empty) *ActionBuilder
WithDestroy configures the builder to set the Behavior field to a Action_Destroy value containing v, then returns b
func (*ActionBuilder) WithEnd ¶
func (b *ActionBuilder) WithEnd(v *Empty) *ActionBuilder
WithEnd configures the builder to set the Behavior field to a Action_End value containing v, then returns b
func (*ActionBuilder) WithExecuteCommand ¶
func (b *ActionBuilder) WithExecuteCommand(v *anypb.Any) *ActionBuilder
WithExecuteCommand configures the builder to set the Behavior field to a Action_ExecuteCommand value containing v, then returns b
func (*ActionBuilder) WithFail ¶
func (b *ActionBuilder) WithFail(v string) *ActionBuilder
WithFail configures the builder to set the Behavior field to a Action_Fail value containing v, then returns b
func (*ActionBuilder) WithLog ¶
func (b *ActionBuilder) WithLog(v string) *ActionBuilder
WithLog configures the builder to set the Behavior field to a Action_Log value containing v, then returns b
func (*ActionBuilder) WithRecordEvent ¶
func (b *ActionBuilder) WithRecordEvent(v *anypb.Any) *ActionBuilder
WithRecordEvent configures the builder to set the Behavior field to a Action_RecordEvent value containing v, then returns b
func (*ActionBuilder) WithScheduleTimeout ¶
func (b *ActionBuilder) WithScheduleTimeout(v *ScheduleTimeoutDetails) *ActionBuilder
WithScheduleTimeout configures the builder to set the Behavior field to a Action_ScheduleTimeout value containing v, then returns b
type Action_Destroy ¶
type Action_Destroy struct {
Destroy *Empty `protobuf:"bytes,6,opt,name=destroy,proto3,oneof"`
}
type Action_End ¶
type Action_End struct {
End *Empty `protobuf:"bytes,7,opt,name=end,proto3,oneof"`
}
type Action_ExecuteCommand ¶
type Action_Fail ¶
type Action_Fail struct {
Fail string `protobuf:"bytes,1,opt,name=fail,proto3,oneof"`
}
type Action_Log ¶
type Action_Log struct {
Log string `protobuf:"bytes,2,opt,name=log,proto3,oneof"`
}
type Action_RecordEvent ¶
type Action_ScheduleTimeout ¶
type Action_ScheduleTimeout struct {
ScheduleTimeout *ScheduleTimeoutDetails `protobuf:"bytes,5,opt,name=schedule_timeout,json=scheduleTimeout,proto3,oneof"`
}
type Actionable ¶
Actionable is a dogma message that provides a set of actions to execute.
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type EmptyBuilder ¶
type EmptyBuilder struct {
// contains filtered or unexported fields
}
func NewEmptyBuilder ¶
func NewEmptyBuilder() *EmptyBuilder
NewEmptyBuilder returns a builder that constructs Empty messages.
func (*EmptyBuilder) Build ¶
func (b *EmptyBuilder) Build() *Empty
Build returns a new Empty containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*EmptyBuilder) From ¶
func (b *EmptyBuilder) From(x *Empty) *EmptyBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
type ScheduleTimeoutDetails ¶
type ScheduleTimeoutDetails struct {
Timeout *anypb.Any `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"`
At *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=at,proto3" json:"at,omitempty"`
// contains filtered or unexported fields
}
func (*ScheduleTimeoutDetails) Descriptor
deprecated
func (*ScheduleTimeoutDetails) Descriptor() ([]byte, []int)
Deprecated: Use ScheduleTimeoutDetails.ProtoReflect.Descriptor instead.
func (*ScheduleTimeoutDetails) GetAt ¶
func (x *ScheduleTimeoutDetails) GetAt() *timestamppb.Timestamp
func (*ScheduleTimeoutDetails) GetTimeout ¶
func (x *ScheduleTimeoutDetails) GetTimeout() *anypb.Any
func (*ScheduleTimeoutDetails) ProtoMessage ¶
func (*ScheduleTimeoutDetails) ProtoMessage()
func (*ScheduleTimeoutDetails) ProtoReflect ¶
func (x *ScheduleTimeoutDetails) ProtoReflect() protoreflect.Message
func (*ScheduleTimeoutDetails) Reset ¶
func (x *ScheduleTimeoutDetails) Reset()
func (*ScheduleTimeoutDetails) SetAt ¶
func (x *ScheduleTimeoutDetails) SetAt(v *timestamppb.Timestamp)
SetAt sets the x.At field to v, then returns x.
func (*ScheduleTimeoutDetails) SetTimeout ¶
func (x *ScheduleTimeoutDetails) SetTimeout(v *anypb.Any)
SetTimeout sets the x.Timeout field to v, then returns x.
func (*ScheduleTimeoutDetails) String ¶
func (x *ScheduleTimeoutDetails) String() string
type ScheduleTimeoutDetailsBuilder ¶
type ScheduleTimeoutDetailsBuilder struct {
// contains filtered or unexported fields
}
func NewScheduleTimeoutDetailsBuilder ¶
func NewScheduleTimeoutDetailsBuilder() *ScheduleTimeoutDetailsBuilder
NewScheduleTimeoutDetailsBuilder returns a builder that constructs ScheduleTimeoutDetails messages.
func (*ScheduleTimeoutDetailsBuilder) Build ¶
func (b *ScheduleTimeoutDetailsBuilder) Build() *ScheduleTimeoutDetails
Build returns a new ScheduleTimeoutDetails containing the values configured via the builder.
Each call returns a new message, such that future changes to the builder do not modify previously constructed messages.
func (*ScheduleTimeoutDetailsBuilder) From ¶
func (b *ScheduleTimeoutDetailsBuilder) From(x *ScheduleTimeoutDetails) *ScheduleTimeoutDetailsBuilder
From configures the builder to use x as the prototype for new messages, then returns b.
It performs a shallow copy of x, such that any changes made via the builder do not modify x. It does not make a copy of the field values themselves.
func (*ScheduleTimeoutDetailsBuilder) WithAt ¶
func (b *ScheduleTimeoutDetailsBuilder) WithAt(v *timestamppb.Timestamp) *ScheduleTimeoutDetailsBuilder
WithAt configures the builder to set the At field to v, then returns b.
func (*ScheduleTimeoutDetailsBuilder) WithTimeout ¶
func (b *ScheduleTimeoutDetailsBuilder) WithTimeout(v *anypb.Any) *ScheduleTimeoutDetailsBuilder
WithTimeout configures the builder to set the Timeout field to v, then returns b.