events

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const TaskTypeCollectionEvent = "events:collection"

Using a constant prevents typos between the producer and the consumer.

Variables

This section is empty.

Functions

func EnqueueCollectionEvent

func EnqueueCollectionEvent(ctx context.Context, client *asynq.Client, payload CollectionEventPayload) error

EnqueueCollectionEvent creates and enqueues a new generic collection event. When no queue client is configured (e.g. in tests or a deployment without Redis), the event is dropped with a debug log instead of panicking.

Types

type CollectionEventPayload

type CollectionEventPayload struct {
	EventType      EventType      `json:"event_type"`
	CollectionName string         `json:"collection_name"`
	ItemID         uint           `json:"item_id"`
	ItemData       map[string]any `json:"item_data"` // The full data of the item
}

CollectionEventPayload is the generic data structure for a collection event. This is sent from the storage layer to the dispatcher worker.

type EventType

type EventType string

EventType defines the type of collection event that occurred.

const (
	EventTypeCollectionCreated EventType = "collection:created"
	EventTypeCollectionUpdated EventType = "collection:updated"
	EventTypeCollectionDeleted EventType = "collection:deleted"
	EventTypeItemCreated       EventType = "item:created"
	EventTypeItemUpdated       EventType = "item:updated"
	EventTypeItemDeleted       EventType = "item:deleted"
)

Jump to

Keyboard shortcuts

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