Documentation
¶
Overview ¶
Package action provides a mechanism for triggering arbitrary actions within handlers by encoding the actions to perform within Dogma messages.
Index ¶
- Constants
- 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 (x *Action) ClearBehavior()
- func (x *Action) ClearDestroy()
- func (x *Action) ClearEnd()
- func (x *Action) ClearExecuteCommand()
- func (x *Action) ClearFail()
- func (x *Action) ClearLog()
- func (x *Action) ClearRecordEvent()
- func (x *Action) ClearScheduleTimeout()
- 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 (x *Action) HasBehavior() bool
- func (x *Action) HasDestroy() bool
- func (x *Action) HasEnd() bool
- func (x *Action) HasExecuteCommand() bool
- func (x *Action) HasFail() bool
- func (x *Action) HasLog() bool
- func (x *Action) HasRecordEvent() bool
- func (x *Action) HasScheduleTimeout() bool
- func (x *Action) MarshalBinary() ([]byte, error)
- 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)
- func (x *Action) UnmarshalBinary(data []byte) error
- func (x *Action) WhichBehavior() case_Action_Behavior
- 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_builder
- type Actionable
- type Empty
- type EmptyBuilder
- type Empty_builder
- type ScheduleTimeoutDetails
- func (x *ScheduleTimeoutDetails) ClearAt()
- func (x *ScheduleTimeoutDetails) ClearTimeout()
- func (x *ScheduleTimeoutDetails) GetAt() *timestamppb.Timestamp
- func (x *ScheduleTimeoutDetails) GetTimeout() *anypb.Any
- func (x *ScheduleTimeoutDetails) HasAt() bool
- func (x *ScheduleTimeoutDetails) HasTimeout() bool
- func (x *ScheduleTimeoutDetails) MarshalBinary() ([]byte, error)
- 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
- func (x *ScheduleTimeoutDetails) UnmarshalBinary(data []byte) error
- 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 ScheduleTimeoutDetails_builder
- type Scope
Constants ¶
const Action_Behavior_not_set_case case_Action_Behavior = 0
const Action_Destroy_case case_Action_Behavior = 6
const Action_End_case case_Action_Behavior = 7
const Action_ExecuteCommand_case case_Action_Behavior = 3
const Action_Fail_case case_Action_Behavior = 1
const Action_Log_case case_Action_Behavior = 2
const Action_RecordEvent_case case_Action_Behavior = 4
const Action_ScheduleTimeout_case case_Action_Behavior = 5
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 {
// 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) ClearBehavior ¶ added in v0.23.0
func (x *Action) ClearBehavior()
func (*Action) ClearDestroy ¶ added in v0.23.0
func (x *Action) ClearDestroy()
func (*Action) ClearExecuteCommand ¶ added in v0.23.0
func (x *Action) ClearExecuteCommand()
func (*Action) ClearRecordEvent ¶ added in v0.23.0
func (x *Action) ClearRecordEvent()
func (*Action) ClearScheduleTimeout ¶ added in v0.23.0
func (x *Action) ClearScheduleTimeout()
func (*Action) GetDestroy ¶
func (*Action) GetExecuteCommand ¶
func (*Action) GetRecordEvent ¶
func (*Action) GetScheduleTimeout ¶
func (x *Action) GetScheduleTimeout() *ScheduleTimeoutDetails
func (*Action) HasBehavior ¶ added in v0.23.0
func (*Action) HasDestroy ¶ added in v0.23.0
func (*Action) HasExecuteCommand ¶ added in v0.23.0
func (*Action) HasRecordEvent ¶ added in v0.23.0
func (*Action) HasScheduleTimeout ¶ added in v0.23.0
func (*Action) MarshalBinary ¶ added in v0.18.0
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *Action to implement encoding.BinaryMarshaler.
func (*Action) ProtoMessage ¶
func (*Action) ProtoMessage()
func (*Action) ProtoReflect ¶
func (x *Action) ProtoReflect() protoreflect.Message
func (*Action) SetDestroy ¶
func (*Action) SetExecuteCommand ¶
func (*Action) SetRecordEvent ¶
func (*Action) SetScheduleTimeout ¶
func (x *Action) SetScheduleTimeout(v *ScheduleTimeoutDetails)
func (*Action) TryGetDestroy ¶ added in v0.10.3
TryGetDestroy returns the Destroy value if x.Behavior is set to Destroy. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetEnd ¶ added in v0.10.3
TryGetEnd returns the End value if x.Behavior is set to End. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetExecuteCommand ¶ added in v0.10.3
TryGetExecuteCommand returns the ExecuteCommand value if x.Behavior is set to ExecuteCommand. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetFail ¶ added in v0.10.3
TryGetFail returns the Fail value if x.Behavior is set to Fail. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetLog ¶ added in v0.10.3
TryGetLog returns the Log value if x.Behavior is set to Log. Otherwise, ok is false and v is the zero-value.
func (*Action) TryGetRecordEvent ¶ added in v0.10.3
TryGetRecordEvent returns the RecordEvent value if x.Behavior is set to 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 the ScheduleTimeout value if x.Behavior is set to ScheduleTimeout. Otherwise, ok is false and v is the zero-value.
func (*Action) UnmarshalBinary ¶ added in v0.18.0
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *Action to implement encoding.BinaryUnmarshaler.
func (*Action) WhichBehavior ¶ added in v0.23.0
func (x *Action) WhichBehavior() case_Action_Behavior
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 Destroy field to v, then returns b.
func (*ActionBuilder) WithEnd ¶
func (b *ActionBuilder) WithEnd(v *Empty) *ActionBuilder
WithEnd configures the builder to set the End field to v, then returns b.
func (*ActionBuilder) WithExecuteCommand ¶
func (b *ActionBuilder) WithExecuteCommand(v *anypb.Any) *ActionBuilder
WithExecuteCommand configures the builder to set the ExecuteCommand field to v, then returns b.
func (*ActionBuilder) WithFail ¶
func (b *ActionBuilder) WithFail(v string) *ActionBuilder
WithFail configures the builder to set the Fail field to v, then returns b.
func (*ActionBuilder) WithLog ¶
func (b *ActionBuilder) WithLog(v string) *ActionBuilder
WithLog configures the builder to set the Log field to v, then returns b.
func (*ActionBuilder) WithRecordEvent ¶
func (b *ActionBuilder) WithRecordEvent(v *anypb.Any) *ActionBuilder
WithRecordEvent configures the builder to set the RecordEvent field to v, then returns b.
func (*ActionBuilder) WithScheduleTimeout ¶
func (b *ActionBuilder) WithScheduleTimeout(v *ScheduleTimeoutDetails) *ActionBuilder
WithScheduleTimeout configures the builder to set the ScheduleTimeout field to v, then returns b.
type Action_builder ¶ added in v0.23.0
type Action_builder struct {
// Fields of oneof xxx_hidden_Behavior:
Fail *string
Log *string
ExecuteCommand *anypb.Any
RecordEvent *anypb.Any
ScheduleTimeout *ScheduleTimeoutDetails
Destroy *Empty
End *Empty
// contains filtered or unexported fields
}
func (Action_builder) Build ¶ added in v0.23.0
func (b0 Action_builder) Build() *Action
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) MarshalBinary ¶ added in v0.18.0
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *Empty to implement encoding.BinaryMarshaler.
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
func (*Empty) UnmarshalBinary ¶ added in v0.18.0
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *Empty to implement encoding.BinaryUnmarshaler.
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 Empty_builder ¶ added in v0.23.0
type Empty_builder struct {
// contains filtered or unexported fields
}
func (Empty_builder) Build ¶ added in v0.23.0
func (b0 Empty_builder) Build() *Empty
type ScheduleTimeoutDetails ¶
type ScheduleTimeoutDetails struct {
// contains filtered or unexported fields
}
func (*ScheduleTimeoutDetails) ClearAt ¶ added in v0.23.0
func (x *ScheduleTimeoutDetails) ClearAt()
func (*ScheduleTimeoutDetails) ClearTimeout ¶ added in v0.23.0
func (x *ScheduleTimeoutDetails) ClearTimeout()
func (*ScheduleTimeoutDetails) GetAt ¶
func (x *ScheduleTimeoutDetails) GetAt() *timestamppb.Timestamp
func (*ScheduleTimeoutDetails) GetTimeout ¶
func (x *ScheduleTimeoutDetails) GetTimeout() *anypb.Any
func (*ScheduleTimeoutDetails) HasAt ¶ added in v0.23.0
func (x *ScheduleTimeoutDetails) HasAt() bool
func (*ScheduleTimeoutDetails) HasTimeout ¶ added in v0.23.0
func (x *ScheduleTimeoutDetails) HasTimeout() bool
func (*ScheduleTimeoutDetails) MarshalBinary ¶ added in v0.18.0
func (x *ScheduleTimeoutDetails) MarshalBinary() ([]byte, error)
MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).
It allows *ScheduleTimeoutDetails to implement encoding.BinaryMarshaler.
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)
func (*ScheduleTimeoutDetails) SetTimeout ¶
func (x *ScheduleTimeoutDetails) SetTimeout(v *anypb.Any)
func (*ScheduleTimeoutDetails) String ¶
func (x *ScheduleTimeoutDetails) String() string
func (*ScheduleTimeoutDetails) UnmarshalBinary ¶ added in v0.18.0
func (x *ScheduleTimeoutDetails) UnmarshalBinary(data []byte) error
UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).
It allows *ScheduleTimeoutDetails to implement encoding.BinaryUnmarshaler.
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.
type ScheduleTimeoutDetails_builder ¶ added in v0.23.0
type ScheduleTimeoutDetails_builder struct {
Timeout *anypb.Any
At *timestamppb.Timestamp
// contains filtered or unexported fields
}
func (ScheduleTimeoutDetails_builder) Build ¶ added in v0.23.0
func (b0 ScheduleTimeoutDetails_builder) Build() *ScheduleTimeoutDetails