event

package
v0.0.0-...-840a1b4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

View Source
const Key = "event"

Key is the key name of the event in the Gin context.

Variables

View Source
var (
	EvtUserCreated = "user_created"
	EvtUserDeleted = "user_deleted"
)

Functions

func Send

func Send(c *gin.Context, evt E)

Send the event to Event Store.

func ToContext

func ToContext(c Setter, event Event)

ToContext adds the event store to this context if it supports the Setter interface.

Types

type E

type E struct {
	Stream   string
	Data     interface{}
	Metadata map[string]string
}

E represents an event.

type Event

type Event interface {
	Send(E)
}

Event wraps the functions that interactive with the Event Store.

func FromContext

func FromContext(c context.Context) Event

FromContext returns the event store associated with this context.

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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