event

package
v0.0.0-...-e4b6a09 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAndPublish

func BuildAndPublish(ctx context.Context, metadata ...Metadata)

BuildAndPublish builds the event according to the metadata and publish the event The process is done in a separated goroutine

Types

type Event

type Event struct {
	Topic string
	Data  interface{}
}

Event to publish

func New

func New() *Event

New ...

func (*Event) Build

func (e *Event) Build(_ context.Context, metadata ...Metadata) error

Build an event by metadata

func (*Event) Publish

func (e *Event) Publish(ctx context.Context) error

Publish an event

func (*Event) WithTopicEvent

func (e *Event) WithTopicEvent(topicEvent TopicEvent) *Event

WithTopicEvent - builder method

type HookMetaData

type HookMetaData struct {
	ProjectID int64
	PolicyID  int64
	EventType string
	Target    *policy_model.EventTarget
	Payload   *model.Payload
}

HookMetaData defines hook notification related event data

func (*HookMetaData) Resolve

func (h *HookMetaData) Resolve(evt *Event) error

Resolve hook metadata into hook event

type Metadata

type Metadata interface {
	Resolve(event *Event) error
}

Metadata is the event raw data to be processed

type TopicEvent

type TopicEvent interface {
	Topic() string
}

TopicEvent - Events that contains topic information

Jump to

Keyboard shortcuts

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