events

package
v0.0.0-...-4a248c4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SourceMediaBanken    = "mediabanken"
	SourceCloudScheduler = "cloudscheduler"
)

Collection of possible sources for events

View Source
const (
	TypeAssetDelivered    = "asset.delivered"
	TypeRefreshView       = "view.refresh"
	TypeDirectusEvent     = "directus.event"
	TypeSearchReindex     = "search.reindex"
	TypeTranslationsSync  = "translations.sync"
	TypeExportAnswersToBQ = "statistics.exportanswers"
)

Collection of possible event types

View Source
const (
	// EventItemsCreate items.create
	EventItemsCreate = "items.create"
	// EventItemsUpdate items.update
	EventItemsUpdate = "items.update"
	// EventItemsDelete items.delete
	EventItemsDelete = "items.delete"
)

Variables

View Source
var (
	// ErrErrorDuringProcessing returns a sentinel error for processing errors
	ErrErrorDuringProcessing = merry.Sentinel("Error while processing event")
)

Sentinel errors

Functions

This section is empty.

Types

type AssetDelivered

type AssetDelivered struct {
	JSONMetaPath string `json:"jsonMetaPath"`
}

AssetDelivered is the event originating from MEDIABANKEN notifying the system That an update for a VOD episode is available on the storage. Note that this may trigger a creation of a new Episode as required

type Event

type Event struct {
	Event      string `json:"event"`
	Collection string `json:"collection"`
	ID         string `json:"id"`
}

Event represents a payload from the directus hook

type EventHandlerFunc

type EventHandlerFunc func(ctx context.Context, collection string, id string) error

EventHandlerFunc is a function that can process a directus event

type Handler

type Handler struct {
}

Handler for handling directus events

func NewHandler

func NewHandler() *Handler

NewHandler returns a new Handler

func (*Handler) On

func (handler *Handler) On(events []string, callback EventHandlerFunc)

On event, do this:

func (*Handler) Process

func (handler *Handler) Process(ctx context.Context, event Event) []error

Process Event

func (*Handler) ProcessCloudEvent

func (handler *Handler) ProcessCloudEvent(ctx context.Context, e cevent.Event) error

ProcessCloudEvent creates an Event from CloudEvent

type RefreshView

type RefreshView struct {
	ViewName string `json:"viewName"`
	Force    bool   `json:"force"`
}

RefreshView is an event requestig refresh of a view in the DB This is a generic event and the ViewName should be checked against a list of known views to prevent potential abuse

type Service

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

Service contains multiple functions for handling and publishing events

func NewService

func NewService(ctx context.Context, firebaseProjectID string, queries *sqlc.Queries) (*Service, error)

NewService returns a new service

func (*Service) HandleModelUpdate

func (s *Service) HandleModelUpdate(ctx context.Context, collection string, key string) error

HandleModelUpdate handles updates

Jump to

Keyboard shortcuts

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