envelopepb

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 13 Imported by: 2

Documentation

Overview

Package envelopepb provides the "well-known" Envelope type for representing message envelopes as Protocol Buffers messages.

Index

Constants

This section is empty.

Variables

View Source
var File_github_com_dogmatiq_enginekit_protobuf_envelopepb_envelope_proto protoreflect.FileDescriptor

Functions

func Unpack added in v0.19.0

func Unpack(env *Envelope) (dogma.Message, error)

Unpack returns the message contained within an envelope. TODO: Make `UnpackCommand`, etc.

func WithBaggage added in v0.22.0

WithBaggage adds x to the envelope's baggage.

Baggage applies to the envelope being packed and is inherited by downstream messages in the causal chain.

func WithExtension added in v0.22.0

WithExtension adds x to the envelope's extensions.

Extensions apply only to the envelope being packed; they are not inherited by downstream messages in the causal chain.

Types

type Body added in v0.21.0

type Body struct {
	// contains filtered or unexported fields
}

Body contains the metadata and encoded form of a single message in an Envelope or MultiEnvelope.

func (*Body) ClearCreatedAt added in v0.23.0

func (x *Body) ClearCreatedAt()

func (*Body) ClearMessage added in v0.23.0

func (x *Body) ClearMessage()

func (*Body) ClearMessageId added in v0.23.0

func (x *Body) ClearMessageId()

func (*Body) ClearScheduledFor added in v0.23.0

func (x *Body) ClearScheduledFor()

func (*Body) GetBaggage added in v0.22.0

func (x *Body) GetBaggage() []*anypb.Any

func (*Body) GetCreatedAt added in v0.21.0

func (x *Body) GetCreatedAt() *timestamppb.Timestamp

func (*Body) GetExtensions added in v0.21.0

func (x *Body) GetExtensions() []*anypb.Any

func (*Body) GetIdempotencyKey added in v0.21.0

func (x *Body) GetIdempotencyKey() string

func (*Body) GetMessage added in v0.21.0

func (x *Body) GetMessage() *Message

func (*Body) GetMessageId added in v0.21.0

func (x *Body) GetMessageId() *uuidpb.UUID

func (*Body) GetScheduledFor added in v0.21.0

func (x *Body) GetScheduledFor() *timestamppb.Timestamp

func (*Body) HasCreatedAt added in v0.23.0

func (x *Body) HasCreatedAt() bool

func (*Body) HasMessage added in v0.23.0

func (x *Body) HasMessage() bool

func (*Body) HasMessageId added in v0.23.0

func (x *Body) HasMessageId() bool

func (*Body) HasScheduledFor added in v0.23.0

func (x *Body) HasScheduledFor() bool

func (*Body) MarshalBinary added in v0.21.0

func (x *Body) MarshalBinary() ([]byte, error)

MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).

It allows *Body to implement encoding.BinaryMarshaler.

func (*Body) ProtoMessage added in v0.21.0

func (*Body) ProtoMessage()

func (*Body) ProtoReflect added in v0.21.0

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

func (*Body) Reset added in v0.21.0

func (x *Body) Reset()

func (*Body) SetBaggage added in v0.22.0

func (x *Body) SetBaggage(v []*anypb.Any)

func (*Body) SetCreatedAt added in v0.21.0

func (x *Body) SetCreatedAt(v *timestamppb.Timestamp)

func (*Body) SetExtensions added in v0.21.0

func (x *Body) SetExtensions(v []*anypb.Any)

func (*Body) SetIdempotencyKey added in v0.21.0

func (x *Body) SetIdempotencyKey(v string)

func (*Body) SetMessage added in v0.21.0

func (x *Body) SetMessage(v *Message)

func (*Body) SetMessageId added in v0.21.0

func (x *Body) SetMessageId(v *uuidpb.UUID)

func (*Body) SetScheduledFor added in v0.21.0

func (x *Body) SetScheduledFor(v *timestamppb.Timestamp)

func (*Body) String added in v0.21.0

func (x *Body) String() string

func (*Body) UnmarshalBinary added in v0.21.0

func (x *Body) UnmarshalBinary(data []byte) error

UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).

It allows *Body to implement encoding.BinaryUnmarshaler.

type BodyBuilder added in v0.21.0

type BodyBuilder struct {
	// contains filtered or unexported fields
}

func NewBodyBuilder added in v0.21.0

func NewBodyBuilder() *BodyBuilder

NewBodyBuilder returns a builder that constructs Body messages.

func (*BodyBuilder) Build added in v0.21.0

func (b *BodyBuilder) Build() *Body

Build returns a new Body 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 (*BodyBuilder) From added in v0.21.0

func (b *BodyBuilder) From(x *Body) *BodyBuilder

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 (*BodyBuilder) WithBaggage added in v0.22.0

func (b *BodyBuilder) WithBaggage(v []*anypb.Any) *BodyBuilder

WithBaggage configures the builder to set the Baggage field to v, then returns b.

func (*BodyBuilder) WithCreatedAt added in v0.21.0

func (b *BodyBuilder) WithCreatedAt(v *timestamppb.Timestamp) *BodyBuilder

WithCreatedAt configures the builder to set the CreatedAt field to v, then returns b.

func (*BodyBuilder) WithExtensions added in v0.21.0

func (b *BodyBuilder) WithExtensions(v []*anypb.Any) *BodyBuilder

WithExtensions configures the builder to set the Extensions field to v, then returns b.

func (*BodyBuilder) WithIdempotencyKey added in v0.21.0

func (b *BodyBuilder) WithIdempotencyKey(v string) *BodyBuilder

WithIdempotencyKey configures the builder to set the IdempotencyKey field to v, then returns b.

func (*BodyBuilder) WithMessage added in v0.21.0

func (b *BodyBuilder) WithMessage(v *Message) *BodyBuilder

WithMessage configures the builder to set the Message field to v, then returns b.

func (*BodyBuilder) WithMessageId added in v0.21.0

func (b *BodyBuilder) WithMessageId(v *uuidpb.UUID) *BodyBuilder

WithMessageId configures the builder to set the MessageId field to v, then returns b.

func (*BodyBuilder) WithScheduledFor added in v0.21.0

func (b *BodyBuilder) WithScheduledFor(v *timestamppb.Timestamp) *BodyBuilder

WithScheduledFor configures the builder to set the ScheduledFor field to v, then returns b.

type Body_builder added in v0.23.0

type Body_builder struct {

	// MessageId is a unique identifier for the message in this envelope.
	MessageId *uuidpb.UUID
	// IdempotencyKey is an application-defined value used to identify a command
	// across retries.
	//
	// It is the zero-value if the message is not a command, or if the producer
	// of the message did not provide an idempotency key.
	IdempotencyKey string
	// CreatedAt is the time at which the envelope was created.
	//
	// This is typically the point at which the message first enters the engine.
	CreatedAt *timestamppb.Timestamp
	// ScheduledFor is the time at which a timeout message is scheduled to occur.
	//
	// It is the zero-value if the message is a command or event.
	ScheduledFor *timestamppb.Timestamp
	// Message is the encoded representation of the [dogma.Message].
	Message *Message
	// Extensions is a set of extension values associated with this message.
	//
	// Any values in [Header.Extensions] are overridden by values in this field
	// that have the same type URL.
	Extensions []*anypb.Any
	// Baggage is a set of extension values associated with this message and/or
	// its causal chain.
	//
	// Any values in [Header.Baggage] are overridden by values in this field
	// that have the same type URL.
	Baggage []*anypb.Any
	// contains filtered or unexported fields
}

func (Body_builder) Build added in v0.23.0

func (b0 Body_builder) Build() *Body

type EffectPacker added in v0.22.0

type EffectPacker struct {
	// contains filtered or unexported fields
}

An EffectPacker packs messages produced while handling a specific causal message into a MultiEnvelope.

func (*EffectPacker) PackCommand added in v0.22.0

func (p *EffectPacker) PackCommand(m dogma.Command, options ...PackEffectCommandOption)

PackCommand appends m to the multi-envelope under construction.

func (*EffectPacker) PackEvent added in v0.22.0

func (p *EffectPacker) PackEvent(m dogma.Event, options ...PackEffectEventOption)

PackEvent appends m to the multi-envelope under construction.

func (*EffectPacker) PackTimeout added in v0.22.0

func (p *EffectPacker) PackTimeout(m dogma.Timeout, options ...PackEffectTimeoutOption)

PackTimeout appends m to the multi-envelope under construction.

func (*EffectPacker) Seal added in v0.22.0

func (p *EffectPacker) Seal() (*MultiEnvelope, bool)

Seal returns a MultiEnvelope containing all packed messages, or false if no messages were packed.

type Envelope

type Envelope struct {
	// contains filtered or unexported fields
}

Envelope is a container for a Dogma message and its meta-data.

It is wire-compatible with MultiEnvelope.

func (*Envelope) ClearBody added in v0.23.0

func (x *Envelope) ClearBody()

func (*Envelope) ClearHeader added in v0.23.0

func (x *Envelope) ClearHeader()

func (*Envelope) GetBody added in v0.21.0

func (x *Envelope) GetBody() *Body

func (*Envelope) GetHeader added in v0.21.0

func (x *Envelope) GetHeader() *Header

func (*Envelope) HasBody added in v0.23.0

func (x *Envelope) HasBody() bool

func (*Envelope) HasHeader added in v0.23.0

func (x *Envelope) HasHeader() bool

func (*Envelope) MarshalBinary added in v0.18.0

func (x *Envelope) MarshalBinary() ([]byte, error)

MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).

It allows *Envelope to implement encoding.BinaryMarshaler.

func (*Envelope) ProtoMessage

func (*Envelope) ProtoMessage()

func (*Envelope) ProtoReflect

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

func (*Envelope) Reset

func (x *Envelope) Reset()

func (*Envelope) SetBody added in v0.21.0

func (x *Envelope) SetBody(v *Body)

func (*Envelope) SetHeader added in v0.21.0

func (x *Envelope) SetHeader(v *Header)

func (*Envelope) String

func (x *Envelope) String() string

func (*Envelope) UnmarshalBinary added in v0.18.0

func (x *Envelope) UnmarshalBinary(data []byte) error

UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).

It allows *Envelope to implement encoding.BinaryUnmarshaler.

func (*Envelope) Validate

func (x *Envelope) Validate() error

Validate returns an error if x is not well-formed.

Well-formedness means that all compulsory fields are populated and that no incompatible fields are populated.

It is intentionally fairly permissive, so that message meta-data can be obtained even if the message is unable to be handled.

It does not perform "deep" validation, such as ensuring messages, times, etc can be unmarshaled.

type EnvelopeBuilder

type EnvelopeBuilder struct {
	// contains filtered or unexported fields
}

func NewEnvelopeBuilder

func NewEnvelopeBuilder() *EnvelopeBuilder

NewEnvelopeBuilder returns a builder that constructs Envelope messages.

func (*EnvelopeBuilder) Build

func (b *EnvelopeBuilder) Build() *Envelope

Build returns a new Envelope 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 (*EnvelopeBuilder) 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 (*EnvelopeBuilder) WithBody added in v0.21.0

func (b *EnvelopeBuilder) WithBody(v *Body) *EnvelopeBuilder

WithBody configures the builder to set the Body field to v, then returns b.

func (*EnvelopeBuilder) WithHeader added in v0.21.0

func (b *EnvelopeBuilder) WithHeader(v *Header) *EnvelopeBuilder

WithHeader configures the builder to set the Header field to v, then returns b.

type Envelope_builder added in v0.23.0

type Envelope_builder struct {
	Header *Header
	Body   *Body
	// contains filtered or unexported fields
}

func (Envelope_builder) Build added in v0.23.0

func (b0 Envelope_builder) Build() *Envelope
type Header struct {
	// contains filtered or unexported fields
}

func (*Header) ClearCausationId added in v0.23.0

func (x *Header) ClearCausationId()

func (*Header) ClearCorrelationId added in v0.23.0

func (x *Header) ClearCorrelationId()

func (*Header) ClearSource added in v0.23.0

func (x *Header) ClearSource()

func (*Header) GetBaggage added in v0.22.0

func (x *Header) GetBaggage() []*anypb.Any

func (*Header) GetCausationId added in v0.21.0

func (x *Header) GetCausationId() *uuidpb.UUID

func (*Header) GetCorrelationId added in v0.21.0

func (x *Header) GetCorrelationId() *uuidpb.UUID

func (*Header) GetExtensions added in v0.21.0

func (x *Header) GetExtensions() []*anypb.Any

func (*Header) GetSource added in v0.21.0

func (x *Header) GetSource() *Source

func (*Header) HasCausationId added in v0.23.0

func (x *Header) HasCausationId() bool

func (*Header) HasCorrelationId added in v0.23.0

func (x *Header) HasCorrelationId() bool

func (*Header) HasSource added in v0.23.0

func (x *Header) HasSource() bool

func (*Header) MarshalBinary added in v0.21.0

func (x *Header) MarshalBinary() ([]byte, error)

MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).

It allows *Header to implement encoding.BinaryMarshaler.

func (*Header) ProtoMessage added in v0.21.0

func (*Header) ProtoMessage()

func (*Header) ProtoReflect added in v0.21.0

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

func (*Header) Reset added in v0.21.0

func (x *Header) Reset()

func (*Header) SetBaggage added in v0.22.0

func (x *Header) SetBaggage(v []*anypb.Any)

func (*Header) SetCausationId added in v0.21.0

func (x *Header) SetCausationId(v *uuidpb.UUID)

func (*Header) SetCorrelationId added in v0.21.0

func (x *Header) SetCorrelationId(v *uuidpb.UUID)

func (*Header) SetExtensions added in v0.21.0

func (x *Header) SetExtensions(v []*anypb.Any)

func (*Header) SetSource added in v0.21.0

func (x *Header) SetSource(v *Source)

func (*Header) String added in v0.21.0

func (x *Header) String() string

func (*Header) UnmarshalBinary added in v0.21.0

func (x *Header) UnmarshalBinary(data []byte) error

UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).

It allows *Header to implement encoding.BinaryUnmarshaler.

type HeaderBuilder added in v0.21.0

type HeaderBuilder struct {
	// contains filtered or unexported fields
}

func NewHeaderBuilder added in v0.21.0

func NewHeaderBuilder() *HeaderBuilder

NewHeaderBuilder returns a builder that constructs Header messages.

func (*HeaderBuilder) Build added in v0.21.0

func (b *HeaderBuilder) Build() *Header

Build returns a new Header 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 (*HeaderBuilder) From added in v0.21.0

func (b *HeaderBuilder) From(x *Header) *HeaderBuilder

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 (*HeaderBuilder) WithBaggage added in v0.22.0

func (b *HeaderBuilder) WithBaggage(v []*anypb.Any) *HeaderBuilder

WithBaggage configures the builder to set the Baggage field to v, then returns b.

func (*HeaderBuilder) WithCausationId added in v0.21.0

func (b *HeaderBuilder) WithCausationId(v *uuidpb.UUID) *HeaderBuilder

WithCausationId configures the builder to set the CausationId field to v, then returns b.

func (*HeaderBuilder) WithCorrelationId added in v0.21.0

func (b *HeaderBuilder) WithCorrelationId(v *uuidpb.UUID) *HeaderBuilder

WithCorrelationId configures the builder to set the CorrelationId field to v, then returns b.

func (*HeaderBuilder) WithExtensions added in v0.21.0

func (b *HeaderBuilder) WithExtensions(v []*anypb.Any) *HeaderBuilder

WithExtensions configures the builder to set the Extensions field to v, then returns b.

func (*HeaderBuilder) WithSource added in v0.21.0

func (b *HeaderBuilder) WithSource(v *Source) *HeaderBuilder

WithSource configures the builder to set the Source field to v, then returns b.

type Header_builder added in v0.23.0

type Header_builder struct {

	// CausationId is the (optional) ID of the message that was the direct cause
	// of the messages.
	//
	// If it is the zero-value, the messages were not caused by any other
	// message.
	CausationId *uuidpb.UUID
	// CorrelationId is the (optional) ID of the first ancestor of the messages
	// that was itself not caused by another message, that is, it's the root of
	// the message chain that ultimately resulted in these messages.
	//
	// If it is the zero-value, the messages were not caused by any other
	// message.
	CorrelationId *uuidpb.UUID
	// Source identifies the origin of the messages.
	Source *Source
	// Extensions is a set of extension values associated with the messages,
	// their causal chain, or the envelope itself.
	Extensions []*anypb.Any
	// Baggage is a set of extension values that are propagated through the
	// entire causal chain of messages.
	Baggage []*anypb.Any
	// contains filtered or unexported fields
}

func (Header_builder) Build added in v0.23.0

func (b0 Header_builder) Build() *Header

type Message added in v0.21.0

type Message struct {
	// contains filtered or unexported fields
}

Message is the serialized representation of a dogma.Message.

func (*Message) ClearTypeId added in v0.23.0

func (x *Message) ClearTypeId()

func (*Message) GetData added in v0.21.0

func (x *Message) GetData() []byte

func (*Message) GetDescription added in v0.21.0

func (x *Message) GetDescription() string

func (*Message) GetTypeId added in v0.21.0

func (x *Message) GetTypeId() *uuidpb.UUID

func (*Message) HasTypeId added in v0.23.0

func (x *Message) HasTypeId() bool

func (*Message) MarshalBinary added in v0.21.0

func (x *Message) MarshalBinary() ([]byte, error)

MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).

It allows *Message to implement encoding.BinaryMarshaler.

func (*Message) ProtoMessage added in v0.21.0

func (*Message) ProtoMessage()

func (*Message) ProtoReflect added in v0.21.0

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

func (*Message) Reset added in v0.21.0

func (x *Message) Reset()

func (*Message) SetData added in v0.21.0

func (x *Message) SetData(v []byte)

func (*Message) SetDescription added in v0.21.0

func (x *Message) SetDescription(v string)

func (*Message) SetTypeId added in v0.21.0

func (x *Message) SetTypeId(v *uuidpb.UUID)

func (*Message) String added in v0.21.0

func (x *Message) String() string

func (*Message) UnmarshalBinary added in v0.21.0

func (x *Message) UnmarshalBinary(data []byte) error

UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).

It allows *Message to implement encoding.BinaryUnmarshaler.

type MessageBuilder added in v0.21.0

type MessageBuilder struct {
	// contains filtered or unexported fields
}

func NewMessageBuilder added in v0.21.0

func NewMessageBuilder() *MessageBuilder

NewMessageBuilder returns a builder that constructs Message messages.

func (*MessageBuilder) Build added in v0.21.0

func (b *MessageBuilder) Build() *Message

Build returns a new Message 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 (*MessageBuilder) From added in v0.21.0

func (b *MessageBuilder) From(x *Message) *MessageBuilder

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 (*MessageBuilder) WithData added in v0.21.0

func (b *MessageBuilder) WithData(v []byte) *MessageBuilder

WithData configures the builder to set the Data field to v, then returns b.

func (*MessageBuilder) WithDescription added in v0.21.0

func (b *MessageBuilder) WithDescription(v string) *MessageBuilder

WithDescription configures the builder to set the Description field to v, then returns b.

func (*MessageBuilder) WithTypeId added in v0.21.0

func (b *MessageBuilder) WithTypeId(v *uuidpb.UUID) *MessageBuilder

WithTypeId configures the builder to set the TypeId field to v, then returns b.

type Message_builder added in v0.23.0

type Message_builder struct {

	// TypeId is a unique identifier for the type of message, as per the Dogma
	// message type registry.
	TypeId *uuidpb.UUID
	// Description is a human-readable description of the message, as returned by
	// the [dogma.Message.MessageDescription] method.
	Description string
	// Data is the binary message data obtained by calling
	// [dogma.Message.MarshalBinary] on the message.
	Data []byte
	// contains filtered or unexported fields
}

func (Message_builder) Build added in v0.23.0

func (b0 Message_builder) Build() *Message

type MultiEnvelope added in v0.21.0

type MultiEnvelope struct {
	// contains filtered or unexported fields
}

MultiEnvelope is an efficient encoding of an ordered sequence of Envelope values that share common header context.

func (*MultiEnvelope) ClearHeader added in v0.23.0

func (x *MultiEnvelope) ClearHeader()

func (*MultiEnvelope) GetBodies added in v0.21.0

func (x *MultiEnvelope) GetBodies() []*Body

func (*MultiEnvelope) GetHeader added in v0.21.0

func (x *MultiEnvelope) GetHeader() *Header

func (*MultiEnvelope) HasHeader added in v0.23.0

func (x *MultiEnvelope) HasHeader() bool

func (*MultiEnvelope) MarshalBinary added in v0.21.0

func (x *MultiEnvelope) MarshalBinary() ([]byte, error)

MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).

It allows *MultiEnvelope to implement encoding.BinaryMarshaler.

func (*MultiEnvelope) ProtoMessage added in v0.21.0

func (*MultiEnvelope) ProtoMessage()

func (*MultiEnvelope) ProtoReflect added in v0.21.0

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

func (*MultiEnvelope) Reset added in v0.21.0

func (x *MultiEnvelope) Reset()

func (*MultiEnvelope) SetBodies added in v0.21.0

func (x *MultiEnvelope) SetBodies(v []*Body)

func (*MultiEnvelope) SetHeader added in v0.21.0

func (x *MultiEnvelope) SetHeader(v *Header)

func (*MultiEnvelope) String added in v0.21.0

func (x *MultiEnvelope) String() string

func (*MultiEnvelope) UnmarshalBinary added in v0.21.0

func (x *MultiEnvelope) UnmarshalBinary(data []byte) error

UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).

It allows *MultiEnvelope to implement encoding.BinaryUnmarshaler.

func (*MultiEnvelope) Validate added in v0.21.0

func (x *MultiEnvelope) Validate() error

Validate returns an error if x is not well-formed.

Well-formedness means that all compulsory fields are populated and that no incompatible fields are populated.

It is intentionally fairly permissive, so that message meta-data can be obtained even if the message is unable to be handled.

It does not perform "deep" validation, such as ensuring messages, times, etc can be unmarshaled.

type MultiEnvelopeBuilder added in v0.21.0

type MultiEnvelopeBuilder struct {
	// contains filtered or unexported fields
}

func NewMultiEnvelopeBuilder added in v0.21.0

func NewMultiEnvelopeBuilder() *MultiEnvelopeBuilder

NewMultiEnvelopeBuilder returns a builder that constructs MultiEnvelope messages.

func (*MultiEnvelopeBuilder) Build added in v0.21.0

func (b *MultiEnvelopeBuilder) Build() *MultiEnvelope

Build returns a new MultiEnvelope 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 (*MultiEnvelopeBuilder) From added in v0.21.0

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 (*MultiEnvelopeBuilder) WithBodies added in v0.21.0

func (b *MultiEnvelopeBuilder) WithBodies(v []*Body) *MultiEnvelopeBuilder

WithBodies configures the builder to set the Bodies field to v, then returns b.

func (*MultiEnvelopeBuilder) WithHeader added in v0.21.0

WithHeader configures the builder to set the Header field to v, then returns b.

type MultiEnvelope_builder added in v0.23.0

type MultiEnvelope_builder struct {
	Header *Header
	Bodies []*Body
	// contains filtered or unexported fields
}

func (MultiEnvelope_builder) Build added in v0.23.0

type PackCommandOption added in v0.22.0

type PackCommandOption interface {
	// contains filtered or unexported methods
}

PackCommandOption is an option that modifies the behavior of Packer.PackCommand.

func WithIdempotencyKey added in v0.20.1

func WithIdempotencyKey(key string) PackCommandOption

WithIdempotencyKey sets the idempotency key of a command packed via Packer.PackCommand.

type PackEffectCommandOption added in v0.22.0

type PackEffectCommandOption interface {
	// contains filtered or unexported methods
}

PackEffectCommandOption is an option that modifies the behavior of EffectPacker.PackCommand.

type PackEffectEventOption added in v0.22.0

type PackEffectEventOption interface {
	// contains filtered or unexported methods
}

PackEffectEventOption is an option that modifies the behavior of EffectPacker.PackEvent.

type PackEffectTimeoutOption added in v0.22.0

type PackEffectTimeoutOption interface {
	// contains filtered or unexported methods
}

PackEffectTimeoutOption is an option that modifies the behavior of EffectPacker.PackTimeout.

func WithScheduledFor added in v0.12.1

func WithScheduledFor(t time.Time) PackEffectTimeoutOption

WithScheduledFor sets the scheduled time of a timeout packed via EffectPacker.PackTimeout.

type PackEffectsOption added in v0.22.0

type PackEffectsOption interface {
	// contains filtered or unexported methods
}

PackEffectsOption is an option that modifies the behavior of Packer.PackEffects.

func WithInstanceID added in v0.12.1

func WithInstanceID(id string) PackEffectsOption

WithInstanceID sets the aggregate or process instance ID that is the source of messages packed via Packer.PackEffects.

type Packer added in v0.12.1

type Packer struct {
	// Site is the (optional) identity of the site that the source application
	// is running within.
	//
	// The site is used to disambiguate between messages from different
	// installations of the same application.
	Site *identitypb.Identity

	// Application is the identity of the application that is the source of the
	// messages.
	Application *identitypb.Identity

	// GenerateID is a function used to generate new message IDs.
	//
	// If it is nil, a random UUID is generated.
	GenerateID func() *uuidpb.UUID

	// Now is a function used to get the current time. If it is nil, time.Now()
	// is used.
	Now func() time.Time
}

A Packer puts messages into envelopes.

func (*Packer) PackCommand added in v0.22.0

func (p *Packer) PackCommand(m dogma.Command, options ...PackCommandOption) *Envelope

PackCommand returns an envelope containing the given command.

func (*Packer) PackEffects added in v0.22.0

func (p *Packer) PackEffects(
	cause *Envelope,
	h *identitypb.Identity,
	options ...PackEffectsOption,
) *EffectPacker

PackEffects returns an EffectPacker that packs messages produced by h while handling cause.

type Source added in v0.21.0

type Source struct {
	// contains filtered or unexported fields
}

Source identifies where a message originated.

func (*Source) ClearApplication added in v0.23.0

func (x *Source) ClearApplication()

func (*Source) ClearHandler added in v0.23.0

func (x *Source) ClearHandler()

func (*Source) ClearSite added in v0.23.0

func (x *Source) ClearSite()

func (*Source) GetApplication added in v0.21.0

func (x *Source) GetApplication() *identitypb.Identity

func (*Source) GetHandler added in v0.21.0

func (x *Source) GetHandler() *identitypb.Identity

func (*Source) GetInstanceId added in v0.21.0

func (x *Source) GetInstanceId() string

func (*Source) GetSite added in v0.21.0

func (x *Source) GetSite() *identitypb.Identity

func (*Source) HasApplication added in v0.23.0

func (x *Source) HasApplication() bool

func (*Source) HasHandler added in v0.23.0

func (x *Source) HasHandler() bool

func (*Source) HasSite added in v0.23.0

func (x *Source) HasSite() bool

func (*Source) MarshalBinary added in v0.21.0

func (x *Source) MarshalBinary() ([]byte, error)

MarshalBinary returns the binary representation of the message, equivalent to calling proto.Marshal(x).

It allows *Source to implement encoding.BinaryMarshaler.

func (*Source) ProtoMessage added in v0.21.0

func (*Source) ProtoMessage()

func (*Source) ProtoReflect added in v0.21.0

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

func (*Source) Reset added in v0.21.0

func (x *Source) Reset()

func (*Source) SetApplication added in v0.21.0

func (x *Source) SetApplication(v *identitypb.Identity)

func (*Source) SetHandler added in v0.21.0

func (x *Source) SetHandler(v *identitypb.Identity)

func (*Source) SetInstanceId added in v0.21.0

func (x *Source) SetInstanceId(v string)

func (*Source) SetSite added in v0.21.0

func (x *Source) SetSite(v *identitypb.Identity)

func (*Source) String added in v0.21.0

func (x *Source) String() string

func (*Source) UnmarshalBinary added in v0.21.0

func (x *Source) UnmarshalBinary(data []byte) error

UnmarshalBinary populates x from its binary representation, equivalent to calling proto.Unmarshal(data, x).

It allows *Source to implement encoding.BinaryUnmarshaler.

type SourceBuilder added in v0.21.0

type SourceBuilder struct {
	// contains filtered or unexported fields
}

func NewSourceBuilder added in v0.21.0

func NewSourceBuilder() *SourceBuilder

NewSourceBuilder returns a builder that constructs Source messages.

func (*SourceBuilder) Build added in v0.21.0

func (b *SourceBuilder) Build() *Source

Build returns a new Source 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 (*SourceBuilder) From added in v0.21.0

func (b *SourceBuilder) From(x *Source) *SourceBuilder

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 (*SourceBuilder) WithApplication added in v0.21.0

func (b *SourceBuilder) WithApplication(v *identitypb.Identity) *SourceBuilder

WithApplication configures the builder to set the Application field to v, then returns b.

func (*SourceBuilder) WithHandler added in v0.21.0

func (b *SourceBuilder) WithHandler(v *identitypb.Identity) *SourceBuilder

WithHandler configures the builder to set the Handler field to v, then returns b.

func (*SourceBuilder) WithInstanceId added in v0.21.0

func (b *SourceBuilder) WithInstanceId(v string) *SourceBuilder

WithInstanceId configures the builder to set the InstanceId field to v, then returns b.

func (*SourceBuilder) WithSite added in v0.21.0

WithSite configures the builder to set the Site field to v, then returns b.

type Source_builder added in v0.23.0

type Source_builder struct {

	// Site is the (optional) identity of the "site" that the source
	// application is running within.
	//
	// The site is used to disambiguate between messages from different
	// installations of the same application.
	Site *identitypb.Identity
	// Application is the identity of the Dogma application that produced the
	// message.
	Application *identitypb.Identity
	// Handler is the identity of the Dogma handler that produced the message.
	//
	// It is the zero-value if the message was not produced by a handler.
	Handler *identitypb.Identity
	// InstanceId is the ID of the aggregate or process instance that produced
	// the message.
	//
	// It is empty if the message was not produced by an aggregate or process
	// handler.
	InstanceId string
	// contains filtered or unexported fields
}

func (Source_builder) Build added in v0.23.0

func (b0 Source_builder) Build() *Source

Jump to

Keyboard shortcuts

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