message

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package message contains the message creation strategies

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityHint

type EntityHint struct {
	ProviderImplementsHint string `json:"provider_implements_hint"`
	ProviderClassHint      string `json:"provider_class_hint"`
}

EntityHint is a hint that is used to help the entity handler find the entity.

type HandleEntityAndDoMessage

type HandleEntityAndDoMessage struct {
	Entity     TypedProps `json:"entity"`
	Originator TypedProps `json:"owner"`
	// Hint is used to help the entity handler find the entity upstream
	// using the property service. A typical use case is to use the provider
	// in the hint and an upstream ID in the Entity.GetByProps attribute
	Hint EntityHint `json:"hint"`
	// MatchProps is used to match the properties of the found entity. One
	// use-case is to include the hook ID in the MatchProps to match against
	// the entity's hook ID to avoid forwading the message to the wrong entity.
	MatchProps map[string]any `json:"match_props"`
}

HandleEntityAndDoMessage is a message that is sent to the entity handler to refresh an entity and perform an action.

func NewEntityRefreshAndDoMessage

func NewEntityRefreshAndDoMessage() *HandleEntityAndDoMessage

NewEntityRefreshAndDoMessage creates a new HandleEntityAndDoMessage struct.

func ToEntityRefreshAndDo

func ToEntityRefreshAndDo(msg *message.Message) (*HandleEntityAndDoMessage, error)

ToEntityRefreshAndDo converts a Watermill message to a HandleEntityAndDoMessage struct.

func (*HandleEntityAndDoMessage) ToMessage

func (e *HandleEntityAndDoMessage) ToMessage(msg *message.Message) error

ToMessage converts the HandleEntityAndDoMessage struct to a Watermill message.

func (*HandleEntityAndDoMessage) WithEntity

func (e *HandleEntityAndDoMessage) WithEntity(entType v1.Entity, getByProps *properties.Properties) *HandleEntityAndDoMessage

WithEntity sets the entity and its properties.

func (*HandleEntityAndDoMessage) WithEntityID

func (e *HandleEntityAndDoMessage) WithEntityID(entityID uuid.UUID) *HandleEntityAndDoMessage

WithEntityID sets the entity ID for the entity that will be used when looking up the entity.

func (*HandleEntityAndDoMessage) WithMatchProps

WithMatchProps sets the properties that must match the properties from the found entity in order to perform the action.

func (*HandleEntityAndDoMessage) WithOriginator

func (e *HandleEntityAndDoMessage) WithOriginator(
	originatorType v1.Entity, originatorProps *properties.Properties,
) *HandleEntityAndDoMessage

WithOriginator sets the owner entity and its properties.

func (*HandleEntityAndDoMessage) WithProviderClassHint

func (e *HandleEntityAndDoMessage) WithProviderClassHint(providerClassHint string) *HandleEntityAndDoMessage

WithProviderClassHint sets the provider hint for the entity that will be used when looking up the entity. to the provider class

func (*HandleEntityAndDoMessage) WithProviderImplementsHint

func (e *HandleEntityAndDoMessage) WithProviderImplementsHint(providerHint string) *HandleEntityAndDoMessage

WithProviderImplementsHint sets the provider hint for the entity that will be used when looking up the entity. to the provider implements hint

type TypedProps

type TypedProps struct {
	Type       v1.Entity      `json:"type"`
	EntityID   uuid.UUID      `json:"entity_id"`
	GetByProps map[string]any `json:"get_by_props"`
}

TypedProps is a struct that contains the type of entity and its properties. it is used for either the entity or the owner entity.

Jump to

Keyboard shortcuts

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