eml

package
v0.10.2-alpha.0...-d05ecc4 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: BSD-3-Clause Imports: 6 Imported by: 7

Documentation

Overview

Package eml implements the Event Markup Language specification

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToYaml

func ToYaml(eml Solution) (string, error)

ToYaml converts Event Markup Language to YAML.

Types

type BoundedContext

type BoundedContext struct {
	Name       string      `yaml:"Name"`
	Streams    []Stream    `yaml:"Streams"`
	Readmodels []Readmodel `yaml:"Readmodels"`
}

A BoundedContext is a context in which a ubiquitous language applies.

type Command

type Command struct {
	Command struct {
		Name           string      `yaml:"Name"`
		Parameters     []Parameter `yaml:"Parameters"`
		Preconditions  []string    `yaml:"Preconditions"`
		Postconditions []string    `yaml:"Postconditions"`
	} `yaml:"Command"`
}

A Command in a bounded context

type Event

type Event struct {
	Event struct {
		Name       string     `yaml:"Name"`
		Properties []Property `yaml:"Properties"`
	} `yaml:"Event"`
}

An Event represents a fact that occurred as a result of a state change.

type Parameter

type Parameter struct {
	Name  string   `yaml:"Name"`
	Type  string   `yaml:"Type"`
	Rules []string `yaml:"Rules"`
}

A Parameter for a command.

func (*Parameter) MustExistInReadmodel

func (r *Parameter) MustExistInReadmodel() string

MustExistInReadmodel gets a rule and it's parameters if it exists, otherwise nil.

func (*Parameter) RuleExists

func (r *Parameter) RuleExists(rule string) bool

RuleExists verifies whether a command parameter validation rule exists.

type Property

type Property struct {
	Name     string `yaml:"Name"`
	Type     string `yaml:"Type"`
	IsHashed bool   `yaml:"IsHashed,omitempty"`
}

A Property of an event.

type Readmodel

type Readmodel struct {
	Readmodel struct {
		Name         string   `yaml:"Name"`
		Key          string   `yaml:"Key"`
		SubscribesTo []string `yaml:"SubscribesTo"`
	} `yaml:"Readmodel"`
}

A Readmodel which subscribes to events

type Solution

type Solution struct {
	EmlVersion string            `yaml:"EmlVersion"`
	Name       string            `yaml:"Solution"`
	Contexts   []BoundedContext  `yaml:"Contexts"`
	Errors     []ValidationError `yaml:"Errors"` // The presence of errors means that no API can be generated for the Solution.
}

A Solution describes an event sourced system It will contain bounded contexts and meta information about what environment to deploy it to. It can also contain references to other bounded contexts from the 'PlayStore' (Context Store? Microservice Store?

func (*Solution) LoadYAML

func (c *Solution) LoadYAML(eml []byte) Solution

LoadYAML loads Event Markup Language YAML into a solution for further processing

func (*Solution) Validate

func (c *Solution) Validate()

Validate if the system is an event sourced system suitable for generating an API.

type Stream

type Stream struct {
	Name     string    `yaml:"Stream"`
	Commands []Command `yaml:"Commands"`
	Events   []Event   `yaml:"Events"`
}

A Stream is a stream of events representing a transactional scope. In Domain Driven Design, this is known as an "aggregate". In comp sci, it can be represented as a state machine.

type ValidationError

type ValidationError struct {
	ErrorID   string
	Context   string
	Stream    string
	Command   string
	Event     string
	Readmodel string
	Message   string
}

A ValidationError means that the eml structure cannot be used to generate an API.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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