event

package
v0.0.0-...-34c6fba Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func OnMeowCreated

func OnMeowCreated(f func(MeowCreatedMessage)) error

func PublishMeowCreated

func PublishMeowCreated(meow schema.Meow) error

func SetEventStore

func SetEventStore(es EventStore)

func SubscribeMeowCreated

func SubscribeMeowCreated() (<-chan MeowCreatedMessage, error)

Types

type EventStore

type EventStore interface {
	Close()
	PublishMeowCreated(meow schema.Meow) error
	SubscribeMeowCreated() (<-chan MeowCreatedMessage, error)
	OnMeowCreated(f func(MeowCreatedMessage)) error
}

type MeowCreatedMessage

type MeowCreatedMessage struct {
	ID        string
	Body      string
	CreatedAt time.Time
}

func (*MeowCreatedMessage) Key

func (m *MeowCreatedMessage) Key() string

type Message

type Message interface {
	Key() string
}

type NatsEventStore

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

func NewNats

func NewNats(url string) (*NatsEventStore, error)

func (*NatsEventStore) Close

func (e *NatsEventStore) Close()

func (*NatsEventStore) OnMeowCreated

func (e *NatsEventStore) OnMeowCreated(f func(MeowCreatedMessage)) (err error)

func (*NatsEventStore) PublishMeowCreated

func (e *NatsEventStore) PublishMeowCreated(meow schema.Meow) error

func (*NatsEventStore) SubscribeMeowCreated

func (e *NatsEventStore) SubscribeMeowCreated() (<-chan MeowCreatedMessage, error)

Jump to

Keyboard shortcuts

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