go-platform: github.com/micro/go-platform/event Index | Files | Directories

package event

import "github.com/micro/go-platform/event"

Package event is an interface for event sourcing.


Package Files

context.go event.go options.go os.go


var (
    RecordTopic      = "micro.event.record"
    DefaultEventType = "event"

func NewContext Uses

func NewContext(ctx context.Context, c Event) context.Context

type Event Uses

type Event interface {
    // publish an event record
    Publish(context.Context, *Record) error
    // subscribe to an event types
    Subscribe(context.Context, Handler, ...string) error
    // Name
    String() string

func FromContext Uses

func FromContext(ctx context.Context) (Event, bool)

func NewEvent Uses

func NewEvent(opts ...Option) Event

type Handler Uses

type Handler func(*Record)

type Option Uses

type Option func(o *Options)

type Options Uses

type Options struct {
    Client client.Client

    // Alternate options
    Context context.Context

type Record Uses

type Record struct {
    Id        string
    Type      string
    Origin    string
    Timestamp int64
    RootId    string
    Metadata  map[string]string
    Data      string


protoPackage go_micro_os_event is a generated protocol buffer package.

Package event imports 6 packages (graph) and is imported by 2 packages. Updated 2018-04-17. Refresh now. Tools for package owners.