event

package
v0.0.0-...-e613b9d Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Occurred is a tag for the time the event occurred.
	Occurred = "occurred"
	// Entered is a tag for the time the event entered.
	Entered = "entered"
)

[DDD Reference - Domain Language](https://domainlanguage.com/ddd/reference/)

Variables

View Source
var (
	GetTopicKeyValueWithContexter = keyvalue.GetTopicKeyValueWithContexter
)

Functions

func SaveEventPayload

func SaveEventPayload(ctx context.Context, repository Saver, keyvalue keyvalue.KeyValuer) error

SaveEventPayload saves an event payload.

func StoreEvent

func StoreEvent(ctx context.Context, message Message) ([]byte, error)

StoreEvent returns a bytes from given Marshaler.

Types

type Closer

type Closer interface {
	Close() error
}

type Event

type Event = pb.Event

type EventWithContext

type EventWithContext struct {
	Context context.Context
	Event   Eventer
}

EventWithContext is Event with context.Context.

func (*EventWithContext) GetContext

func (p *EventWithContext) GetContext() context.Context

GetContext returns context.Context.

func (*EventWithContext) GetEvent

func (p *EventWithContext) GetEvent() Eventer

GetEvent returns Eventer.

func (*EventWithContext) MarshalZerologObject

func (p *EventWithContext) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject writes EventWithContext to given zerolog.Event.

func (*EventWithContext) String

func (p *EventWithContext) String() string

String returns EventWithContext as string.

func (*EventWithContext) Validate

func (p *EventWithContext) Validate() error

Validate returns error if failed validate.

type EventWithContexter

type EventWithContexter interface {
	GetContext() context.Context
	GetEvent() Eventer
	MarshalZerologObject(*zerolog.Event)
	String() string
	Validate() error
}

EventWithContexter is an interface generated for "github.com/michilu/boilerplate/service/event.EventWithContext".

type Eventer

type Eventer = pb.Eventer

func NewEvent

func NewEvent(timeStamp *time.Time, origin string) (Eventer, error)

NewEvent returns a timestamp for the time the event occurred.

func RestoreEvent

func RestoreEvent(ctx context.Context, b []byte) (Eventer, error)

RestoreEvent returns an Eventer from given bytes.

type KeyValueWithContext

type KeyValueWithContext = keyvalue.KeyValueWithContext

type KeyValueWithContexter

type KeyValueWithContexter = keyvalue.KeyValueWithContexter

type Keyer

type Keyer interface {
	GetKey() string
	zerolog.LogObjectMarshaler
}

type Loader

type Loader interface {
	Load(context.Context, keyvalue.KeyPrefixer) (<-chan keyvalue.KeyValuer, error)
}

type Message

type Message interface {
	proto.Message
	zerolog.LogObjectMarshaler
}

type Saver

type Saver interface {
	Save(context.Context, keyvalue.KeyValuer) error
}

type TimePoint

type TimePoint = pb.EventTimePoint

type TopicEventWithContexter

type TopicEventWithContexter interface {
	// Publish returns a '<-chan EventWithContexter' that joins to the given topic.
	Publish(ctx context.Context, c <-chan EventWithContexter)
	// Publisher returns a 'chan<- EventWithContexter' that joins to the given topic.
	Publisher(ctx context.Context) chan<- EventWithContexter
	// Subscribe returns a 'chan<- EventWithContexter' that joins to the given topic.
	Subscribe(c chan<- EventWithContexter)
}

TopicEventWithContexter is a topic.

func GetTopicEventWithContexter

func GetTopicEventWithContexter(topic interface{}) TopicEventWithContexter

GetTopicEventWithContexter returns a TopicEventWithContexter of the given topic.

Jump to

Keyboard shortcuts

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