domain

package
v0.0.0-...-b45a7ae Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildWhereClause

func BuildWhereClause(attributes map[string]values.Value) Q.Expression

TODO: find the proper place

Types

type DomainFunction

type DomainFunction struct {
	// contains filtered or unexported fields
}

func NewDomainFunction

func NewDomainFunction(key DomainFunctionKey, function interface{}) DomainFunction

TODO - when golang finally has got generics: func(ctx DomainFunctionContext, input INPUT_TYPE) (OUTPUT_TYPE, error)

type DomainFunctionAccessor

type DomainFunctionAccessor interface {
	Invoke(input values.Holder) (result values.Holder, err error)
}

type DomainFunctionContext

type DomainFunctionContext interface {
	Entity(name entity.Key) EntityAccessor
}

type DomainFunctionFunc

type DomainFunctionFunc = func(ctx DomainFunctionContext, input values.Holder) (values.Holder, error)

type DomainFunctionKey

type DomainFunctionKey string

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(
	entityExecutorProvider entity.ExecutorProvider,
	domainPersistence Persistence,
) *Engine

func (*Engine) AwaitProcessingAllEvents

func (engine *Engine) AwaitProcessingAllEvents()

func (*Engine) Close

func (engine *Engine) Close()

func (*Engine) Entity

func (engine *Engine) Entity(name entity.Key) EntityAccessor

/ TODO - strong typing: type EntityTypeID string

func (*Engine) Function

func (engine *Engine) Function(key DomainFunctionKey) DomainFunctionAccessor

func (*Engine) GetEntityRevisionRepository

func (engine *Engine) GetEntityRevisionRepository() EntityRevisionRepository

func (*Engine) GetEntityRevisionService

func (engine *Engine) GetEntityRevisionService() *EntityRevisionService

func (*Engine) GetEntityTypeService

func (engine *Engine) GetEntityTypeService() *EntityTypeService

func (*Engine) Projection

func (engine *Engine) Projection(name string) ProjectionAccessor

func (*Engine) SetFunctions

func (engine *Engine) SetFunctions(functions []DomainFunction)

TODO: this should be probably part of domain model specification

func (*Engine) SetSchema

func (engine *Engine) SetSchema(schema *domainModel.Schema)

type EngineDomainAccessor

type EngineDomainAccessor Engine

TODO

func (*EngineDomainAccessor) Entity

func (*EngineDomainAccessor) Projection

func (d *EngineDomainAccessor) Projection(key string) projection.Accessor

type EntityAccessor

type EntityAccessor interface {
	entity.Accessor

	RunTypeFunc(key entity.TypeFuncKey, input interface{}, output interface{}) (err error)
	CommandDefaultInput(id int64, key entity.CommandKey) (values.Holder, error)
}

type EntityFactory

type EntityFactory interface {
	CreateFromValues(tableName *entity.Definition, values values.Holder) entity.Instance
}

type EntityRevision

type EntityRevision interface {
	GetId() int64
	GetRevision() int64
	GetAllAttributes() map[string]interface{}
}

type EntityRevisionRepository

type EntityRevisionRepository interface {
	Find(entityTableName entity.Key, entityId int64) ([]EntityRevision, error)
}

type EntityRevisionService

type EntityRevisionService struct {
	// contains filtered or unexported fields
}

func (EntityRevisionService) Find

func (s EntityRevisionService) Find(entityType *entity.Definition, entityId int64) ([]EntityRevision, error)

type EntityTypeService

type EntityTypeService struct {
	// contains filtered or unexported fields
}

func (EntityTypeService) GetEntityType

func (s EntityTypeService) GetEntityType(name entity.Key) (*entity.Definition, error)

func (EntityTypeService) GetEntityTypes

func (s EntityTypeService) GetEntityTypes() []*entity.Definition

func (EntityTypeService) GetReadModel

func (s EntityTypeService) GetReadModel(name string) (*projection.Definition, error)

type EventProcessorDaemon

type EventProcessorDaemon struct {
	// contains filtered or unexported fields
}

func NewEventProcessorDaemon

func NewEventProcessorDaemon(engine *Engine) *EventProcessorDaemon

func (*EventProcessorDaemon) Close

func (d *EventProcessorDaemon) Close() error

func (*EventProcessorDaemon) Name

func (d *EventProcessorDaemon) Name() string

func (*EventProcessorDaemon) Shutdown

func (d *EventProcessorDaemon) Shutdown(ctx context.Context) error

func (*EventProcessorDaemon) Start

func (d *EventProcessorDaemon) Start()

type EventsRepository

type EventsRepository interface {
	FindUnprocessed(limit int) []*StoredEvent

	Store(event *StoredEvent)
	Remove(id int64)
}

type Persistence

type Persistence interface {
	SetSchema(schema *model.Schema) error

	GetEntityInstanceFactory() EntityFactory
	GetEntityRevisionRepository() EntityRevisionRepository

	Entity(name entity.Key) entity.Repository
	Projection(name string) ProjectionProvider

	Events() EventsRepository
}

Persistence interface defines contract of root/entry point for persistence port.

type ProjectionAccessor

type ProjectionAccessor interface {
	projection.Accessor
}

type ProjectionProvider

type ProjectionProvider interface {
	GetAll() ([]projection.Instance, error)
	Get(entityId int64) (projection.Instance, error)

	// TODO: query should be DTO with tree structure containing clauses/conditions
	FindByQuery(query string, params []interface{}, strings []query.OrderClause) ([]projection.Instance, error)

	EnsureFullyConverged()
}

type StoredEvent

type StoredEvent struct {
	ID       int64
	Instance interface{}
	Error    string
}

Directories

Path Synopsis
Package entity contains all logic for entity definition, entity commands, entity events, and manipulation with entities.
Package entity contains all logic for entity definition, entity commands, entity events, and manipulation with entities.
Package fields provides basic set of fields usable to define domain model
Package fields provides basic set of fields usable to define domain model
internal
Package provides a generic interface to define and interact with core domain model.
Package provides a generic interface to define and interact with core domain model.
testing
x

Jump to

Keyboard shortcuts

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