Documentation
¶
Overview ¶
Package message contains the message creation strategies
Index ¶
- type EntityHint
- type HandleEntityAndDoMessage
- func (e *HandleEntityAndDoMessage) ToMessage(msg *message.Message) error
- func (e *HandleEntityAndDoMessage) WithEntity(entType v1.Entity, getByProps *properties.Properties) *HandleEntityAndDoMessage
- func (e *HandleEntityAndDoMessage) WithEntityID(entityID uuid.UUID) *HandleEntityAndDoMessage
- func (e *HandleEntityAndDoMessage) WithMatchProps(matchProps *properties.Properties) *HandleEntityAndDoMessage
- func (e *HandleEntityAndDoMessage) WithOriginator(originatorType v1.Entity, originatorProps *properties.Properties) *HandleEntityAndDoMessage
- func (e *HandleEntityAndDoMessage) WithProviderClassHint(providerClassHint string) *HandleEntityAndDoMessage
- func (e *HandleEntityAndDoMessage) WithProviderImplementsHint(providerHint string) *HandleEntityAndDoMessage
- type TypedProps
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 ¶
func (e *HandleEntityAndDoMessage) WithMatchProps(matchProps *properties.Properties) *HandleEntityAndDoMessage
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