events

package
v0.0.0-...-c29577a Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PersonGetEventTopic     = "person:get"
	PersonDeletedEventTopic = "person:delete"
	PersonUpdatedEventTopic = "person:update"
	PersonPostEventTopic    = "person:post"
)
View Source
const (
	PersonUpdatedEventType = EventType("Person was updated")
	PersonDeletedEventType = EventType("Person was deleted")
	PersonGetEventType     = EventType("Get person request processed")
	PersonPostEventType    = EventType("Post person request processed")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBusSession

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

func NewEventBusSession

func NewEventBusSession() *EventBusSession

func (*EventBusSession) AsyncConsumeEvents

func (s *EventBusSession) AsyncConsumeEvents(ctx context.Context, topic string, handler any)

func (*EventBusSession) PublishEvent

func (s *EventBusSession) PublishEvent(ctx context.Context, topic string, event any)

type EventType

type EventType string

type PersonDeletedEvent

type PersonDeletedEvent struct {
	Type    EventType
	Payload PersonDeletedEventPayload
}

type PersonDeletedEventPayload

type PersonDeletedEventPayload struct {
	ID string
}

type PersonGetEvent

type PersonGetEvent struct {
	Type    EventType
	Payload PersonGetEventPayload
}

type PersonGetEventPayload

type PersonGetEventPayload struct {
	Person models.Person
}

type PersonPostEvent

type PersonPostEvent struct {
	Type    EventType
	Payload PersonPostEventPayload
}

type PersonPostEventPayload

type PersonPostEventPayload struct {
	ID   int
	Name string
}

type PersonUpdatedEvent

type PersonUpdatedEvent struct {
	Type    EventType
	Payload PersonUpdatedEventPayload
}

type PersonUpdatedEventPayload

type PersonUpdatedEventPayload struct {
	ID string
}

Jump to

Keyboard shortcuts

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