model

package
Version: 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: 4 Imported by: 0

Documentation

Overview

Package provides a generic interface to define and interact with core domain model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainAccessor

type DomainAccessor interface {
	Entity(key entity.Key) entity.Accessor
	Projection(key string) projection.Accessor
}

type EventHandler

type EventHandler interface {
	Handle(domain DomainAccessor, event interface{}) error
}

func EventHandlerFunc

func EventHandlerFunc(f func(domain DomainAccessor, event interface{}) error) EventHandler

type FieldAlias

type FieldAlias interface {
	GetFieldType() field.Field

	MapValueToAlias(original interface{}) (storage interface{}, err error)
	UnmapValueFromAlias(storage interface{}) (original interface{})
}

type PersistenceCompoundField

type PersistenceCompoundField interface {
	field.Field

	GetSubFieldNames() []string
	GetSubFields() []field.Field

	Type() reflect.Type
	MapCompoundValueToSlice(original interface{}) (storage []interface{}, err error)
	UnmapCompoundValueFromSlice(storage []interface{}) (original interface{})

	AllowedNullElement() bool
}

Fields implementing this interface are handled automatically by persistence, without need to implement own driver

type Schema

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

func NewSchema

func NewSchema() *Schema

func (*Schema) EntityTypes

func (schema *Schema) EntityTypes() map[entity.Key]*entity.Definition

func (*Schema) EventHandler

func (schema *Schema) EventHandler() EventHandler

func (*Schema) ReadModels

func (schema *Schema) ReadModels() map[string]*projection.Definition

func (*Schema) Register

func (schema *Schema) Register(entity *entity.Definition)

func (*Schema) RegisterReadModel

func (schema *Schema) RegisterReadModel(readModel *projection.Definition)

func (*Schema) SetEventHandler

func (schema *Schema) SetEventHandler(handler EventHandler)

type UserCompoundField

type UserCompoundField interface {
	GetSubFieldsStruct() field.StructType
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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