action

package
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
) 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 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),
)

Switch_Action_Behavior invokes one of the given functions based on the value of x.Behavior.

It panics if x.Behavior is nil.

Types

type Action

type Action struct {

	// Types that are assignable 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

func ExecuteCommand(c dogma.Command) []*Action

ExecuteCommand returns an action that causes the handler to execute a command message.

func Fail

func Fail(message string) []*Action

Fail returns an action that causes the handler to return an error.

func Log

func Log(message string) []*Action

Log returns an action that causes the handler to log a human-readable message.

func RecordEvent

func RecordEvent(e dogma.Message) []*Action

RecordEvent returns an action that causes the handler to record an event message.

func ScheduleTimeout

func ScheduleTimeout(t dogma.Timeout, at time.Time) []*Action

ScheduleTimeout returns an action that causes the handler to schedule a timeout message.

func Sequence

func Sequence(actions ...[]*Action) []*Action

Sequence returns a new set of actions.

func (*Action) Descriptor deprecated

func (*Action) Descriptor() ([]byte, []int)

Deprecated: Use Action.ProtoReflect.Descriptor instead.

func (*Action) GetBehavior

func (m *Action) GetBehavior() isAction_Behavior

func (*Action) GetDestroy

func (x *Action) GetDestroy() *Empty

func (*Action) GetEnd

func (x *Action) GetEnd() *Empty

func (*Action) GetExecuteCommand

func (x *Action) GetExecuteCommand() *anypb.Any

func (*Action) GetFail

func (x *Action) GetFail() string

func (*Action) GetLog

func (x *Action) GetLog() string

func (*Action) GetRecordEvent

func (x *Action) GetRecordEvent() *anypb.Any

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) Reset

func (x *Action) Reset()

func (*Action) SetDestroy

func (x *Action) SetDestroy(v *Empty)

SetDestroy sets the x.Behavior field to a Action_Destroy value containing v, then returns x.

func (*Action) SetEnd

func (x *Action) SetEnd(v *Empty)

SetEnd sets the x.Behavior field to a Action_End value containing v, then returns x.

func (*Action) SetExecuteCommand

func (x *Action) SetExecuteCommand(v *anypb.Any)

SetExecuteCommand sets the x.Behavior field to a Action_ExecuteCommand value containing v, then returns x.

func (*Action) SetFail

func (x *Action) SetFail(v string)

SetFail sets the x.Behavior field to a Action_Fail value containing v, then returns x.

func (*Action) SetLog

func (x *Action) SetLog(v string)

SetLog sets the x.Behavior field to a Action_Log value containing v, then returns x.

func (*Action) SetRecordEvent

func (x *Action) SetRecordEvent(v *anypb.Any)

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) String

func (x *Action) String() string

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_ExecuteCommand struct {
	ExecuteCommand *anypb.Any `protobuf:"bytes,3,opt,name=execute_command,json=executeCommand,proto3,oneof"`
}

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_RecordEvent struct {
	RecordEvent *anypb.Any `protobuf:"bytes,4,opt,name=record_event,json=recordEvent,proto3,oneof"`
}

type Action_ScheduleTimeout

type Action_ScheduleTimeout struct {
	ScheduleTimeout *ScheduleTimeoutDetails `protobuf:"bytes,5,opt,name=schedule_timeout,json=scheduleTimeout,proto3,oneof"`
}

type Actionable

type Actionable interface {
	dogma.Message
	GetActions() []*Action
}

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) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

func (x *Empty) ProtoReflect() protoreflect.Message

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

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 (*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

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

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

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

WithAt configures the builder to set the At field to v, then returns b.

func (*ScheduleTimeoutDetailsBuilder) WithTimeout

WithTimeout configures the builder to set the Timeout field to v, then returns b.

type Scope

type Scope interface {
	Log(string, ...any)
}

Scope is the interface common to all Dogma scope interfaces.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL