event

package
v0.0.0-...-4515e61 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

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

Consumer of API events

func NewConsumer

func NewConsumer(c pubsub.Consumer) *Consumer

NewConsumer of API events

func (*Consumer) Consume

func (c *Consumer) Consume(ctx context.Context, h HandlerFunc) error

Consume events from the API

type Event

type Event struct {
	Meta    *Meta  `json:"meta"`
	Payload []byte `json:"payload"`
}

Event object with payload, universal unique identifier, its event id

func Decode

func Decode(b []byte) (*Event, error)

Decode an event from a message queue for further usage

type HandlerFunc

type HandlerFunc func(ctx context.Context, e *Event) error

HandlerFunc for API events

type ID

type ID string

ID type for a specific event. This datatype should be used for custom event type definitions.

type Meta

type Meta struct {
	UUID      string    `json:"uuid"`
	ID        ID        `json:"id"`
	Version   string    `json:"version"`
	CreatedAt time.Time `json:"created_at"`
}

Meta information of an event payload

type PayloadMeta

type PayloadMeta struct {
	Version string `json:"version"`
}

PayloadMeta information of a specific. optional to implement

type Producer

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

Producer of events

func NewProducer

func NewProducer(p pubsub.Producer) *Producer

NewProducer of API events

func (*Producer) Produce

func (p *Producer) Produce(ctx context.Context, id ID, payload interface{}) error

Produce a event for API services

Jump to

Keyboard shortcuts

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