events

package
v0.0.0-...-c86e3d9 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArticleCreatedEventType = "ArticleCreatedEvent"

ArticleCreatedEventType is an event

View Source
var ArticleUpdatedEventType = "ArticleUpdatedEvent"

ArticleUpdatedEventType is an event

View Source
var ArticleUpdatedTitleEventType = "ArticleUpdatedTitleEvent"

ArticleUpdatedTitleEventType is an event

Functions

This section is empty.

Types

type ArticleCreatedEvent

type ArticleCreatedEvent struct {
	Title              string `json:"title"`
	Description        string `json:"description"`
	AggregateArticleID string `json:"aggregate_article_id"`
}

ArticleCreatedEvent Event to create an article

func (ArticleCreatedEvent) Apply

func (articleCreatedEvent ArticleCreatedEvent) Apply(ev event.Event) error

Apply To create an aggregate in read-model 1. Create new article state 2. Add event to elastic-search 3. Add read-model to elastic-search

type ArticleCreatedEventHandler

type ArticleCreatedEventHandler struct{}

ArticleCreatedEventHandler allows to create an article

func NewArticleCreatedEventHandler

func NewArticleCreatedEventHandler() *ArticleCreatedEventHandler

NewArticleCreatedEventHandler Creates an instance

func (ArticleCreatedEventHandler) Handle

func (eHandler ArticleCreatedEventHandler) Handle(ev event.Event) error

Handle Creates a new article

type ArticleUpdatedEvent

type ArticleUpdatedEvent struct {
	Title              string `json:"title"`
	Description        string `json:"description"`
	AggregateArticleID string `json:"aggregate_article_id"`
}

ArticleUpdatedEvent Event to update an article

func (ArticleUpdatedEvent) Apply

func (articleUpdatedEvent ArticleUpdatedEvent) Apply(ev event.Event) error

Apply To update an aggregate in read-model 1. Get aggregate from elastic-search 2. update article state 3. Update to elastic-search

type ArticleUpdatedEventHandler

type ArticleUpdatedEventHandler struct{}

ArticleUpdatedEventHandler allows to update an article

func NewArticleUpdatedEventHandler

func NewArticleUpdatedEventHandler() *ArticleUpdatedEventHandler

NewArticleUpdatedEventHandler Creates an instance

func (ArticleUpdatedEventHandler) Handle

func (eHandler ArticleUpdatedEventHandler) Handle(ev event.Event) error

Handle Updates a new article

type ArticleUpdatedTitleEvent

type ArticleUpdatedTitleEvent struct {
	Title              string `json:"title"`
	AggregateArticleID string `json:"aggregate_article_id"`
}

ArticleUpdatedTitleEvent Event to update title of an article

Jump to

Keyboard shortcuts

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