eventqueue

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MutationPropertyEntityID is the standard mutation metadata key used for entity identifiers
	MutationPropertyEntityID = "ID"
	// SoftDeleteOne is a synthetic operation used for soft-delete hooks
	SoftDeleteOne = "SoftDeleteOne"
)

Variables

This section is empty.

Functions

func ClientFromHandler added in v1.11.0

func ClientFromHandler(ctx gala.HandlerContext) (*generated.Client, bool)

ClientFromHandler resolves the ent client from Gala listener dependencies

func MutationEntityID added in v1.11.0

func MutationEntityID(payload MutationGalaPayload, properties map[string]string) (string, bool)

MutationEntityID resolves the mutation entity ID from payload metadata or headers

func MutationFieldChanged added in v1.11.0

func MutationFieldChanged(payload MutationGalaPayload, field string) bool

MutationFieldChanged reports whether a payload indicates a field changed

func MutationStringFromProperties added in v1.11.0

func MutationStringFromProperties(properties map[string]string, field string) string

MutationStringFromProperties returns a trimmed string value from envelope properties

func MutationStringSliceValue added in v1.11.0

func MutationStringSliceValue(payload MutationGalaPayload, field string) []string

MutationStringSliceValue returns a proposed string-slice mutation value for a field

func MutationStringValue added in v1.11.0

func MutationStringValue(payload MutationGalaPayload, field string) (string, bool)

MutationStringValue returns a proposed string mutation value for a field

func MutationStringValueOrProperty added in v1.11.0

func MutationStringValueOrProperty(payload MutationGalaPayload, properties map[string]string, field string) string

MutationStringValueOrProperty returns the proposed string value for a field with property fallback

func MutationStringValuePreferPayload added in v1.11.0

func MutationStringValuePreferPayload(payload MutationGalaPayload, properties map[string]string, field string) string

MutationStringValuePreferPayload returns property fallback only when the field is absent from proposed changes

func MutationTopic added in v1.11.0

func MutationTopic(concern MutationConcern, schemaType string) gala.Topic[MutationGalaPayload]

MutationTopic returns the typed mutation topic for a concern + schema type pair

func MutationTopicName added in v1.11.0

func MutationTopicName(concern MutationConcern, schemaType string) gala.TopicName

MutationTopicName returns the mutation topic name for a concern + schema type pair

func MutationValue added in v1.11.0

func MutationValue(payload MutationGalaPayload, field string) (any, bool)

MutationValue returns a proposed mutation value for a field

func NewGalaHeadersFromMutationMetadata

func NewGalaHeadersFromMutationMetadata(metadata MutationGalaMetadata) gala.Headers

NewGalaHeadersFromMutationMetadata builds Gala headers from mutation metadata

func NewMutationGalaEnvelope

func NewMutationGalaEnvelope(ctx context.Context, g *gala.Gala, topic gala.Topic[MutationGalaPayload], payload MutationGalaPayload, metadata MutationGalaMetadata) (envelope gala.Envelope, err error)

NewMutationGalaEnvelope builds a gala envelope from mutation emit inputs

func ParseEnum added in v1.11.0

func ParseEnum[T ~string](raw any, parser EnumParser[T], invalid ...T) (T, bool)

ParseEnum parses enum-like values through the provided enum parser Optional invalid values can be provided to force known sentinel values to be treated as parse failures

func ValueAsString added in v1.11.0

func ValueAsString(raw any) (string, bool)

ValueAsString converts arbitrary values into non-empty strings

Types

type EnumParser added in v1.11.0

type EnumParser[T ~string] func(string) *T

EnumParser converts a normalized string into an enum pointer value

type MutationConcern added in v1.11.0

type MutationConcern string

MutationConcern identifies the eventing concern namespace for mutation topics

const (
	// MutationConcernDirect is the default concern for direct mutation listeners
	MutationConcernDirect MutationConcern = "direct"
	// MutationConcernWorkflow is the concern for workflow mutation listeners
	MutationConcernWorkflow MutationConcern = "workflow"
	// MutationConcernNotification is the concern for notification mutation listeners
	MutationConcernNotification MutationConcern = "notification"
)

type MutationGalaMetadata

type MutationGalaMetadata struct {
	// EventID is the stable idempotency/event identifier for this mutation dispatch
	EventID string
	// Properties stores string-safe metadata for listener header fallbacks
	Properties map[string]string
}

MutationGalaMetadata captures envelope metadata for Gala mutation dispatch

func NewMutationGalaMetadata

func NewMutationGalaMetadata(eventID string, payload MutationGalaPayload) MutationGalaMetadata

NewMutationGalaMetadata builds metadata for Gala mutation envelopes from mutation payload data

type MutationGalaPayload

type MutationGalaPayload struct {
	// MutationType is the ent schema type that emitted the mutation
	MutationType string `json:"mutation_type"`
	// Operation is the mutation operation string
	Operation string `json:"operation"`
	// EntityID is the mutated entity identifier
	EntityID string `json:"entity_id"`
	// ChangedFields captures updated/cleared fields for the mutation
	ChangedFields []string `json:"changed_fields,omitempty"`
	// ClearedFields captures fields explicitly cleared by the mutation
	ClearedFields []string `json:"cleared_fields,omitempty"`
	// ChangedEdges captures changed edge names for workflow-eligible edges
	ChangedEdges []string `json:"changed_edges,omitempty"`
	// AddedIDs captures edge IDs added by edge name
	AddedIDs map[string][]string `json:"added_ids,omitempty"`
	// RemovedIDs captures edge IDs removed by edge name
	RemovedIDs map[string][]string `json:"removed_ids,omitempty"`
	// ProposedChanges captures field-level proposed values
	ProposedChanges map[string]any `json:"proposed_changes,omitempty"`
}

MutationGalaPayload is the JSON-safe mutation payload contract for gala

func (MutationGalaPayload) ChangeSet added in v1.11.0

func (payload MutationGalaPayload) ChangeSet() mutations.ChangeSet

ChangeSet returns the payload mutation deltas as a shared change-set contract

func (*MutationGalaPayload) SetChangeSet added in v1.11.0

func (payload *MutationGalaPayload) SetChangeSet(changeSet mutations.ChangeSet)

SetChangeSet applies a shared change-set contract onto this payload

Jump to

Keyboard shortcuts

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