event

package
v0.0.0-...-ccf9113 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

func OnBookCreated

func OnBookCreated(f func(BookCreatedMessage)) error

func SetEventStore

func SetEventStore(es EventStore)

func SubsribeBookCreated

func SubsribeBookCreated() (<-chan BookCreatedMessage, error)

Types

type BookCreatedMessage

type BookCreatedMessage struct {
	ID        string
	Name      string
	CreatedAt time.Time
}

func (*BookCreatedMessage) Key

func (m *BookCreatedMessage) Key() string

type EventStore

type EventStore interface {
	Close()
	SubsribeBookCreated() (<-chan BookCreatedMessage, error)
	OnBookCreated(f func(BookCreatedMessage)) error
}

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 (n *NatsEventStore) Close()

func (*NatsEventStore) OnBookCreated

func (n *NatsEventStore) OnBookCreated(f func(BookCreatedMessage)) error

func (*NatsEventStore) SubsribeBookCreated

func (n *NatsEventStore) SubsribeBookCreated() (<-chan BookCreatedMessage, error)

Jump to

Keyboard shortcuts

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