appcore

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: 9 Imported by: 0

Documentation

Overview

Application Core encapsulates domain model access and execution. The primary responsibility is safety guarantee of driving side of ApplicationCore's boundary.

Only DTO is transferred outside of application core, and DTO contains only expected values and no technical details. Authorization validation is performed for all interactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionHandler

type ActionHandler func(ctx context.Context, storage *domain.Engine, input values.Values) (values.Values, error)

type ApplicationCore

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

TODO: check guarantee

func (*ApplicationCore) Engine

func (core *ApplicationCore) Engine() *domain.Engine

TODO: think about open, and whether this should completely seal access to engine,...

func (*ApplicationCore) Entities

func (core *ApplicationCore) Entities() *EntitiesAccessor

func (*ApplicationCore) ExecuteAction

func (core *ApplicationCore) ExecuteAction(ctx context.Context, name string, input values.Values) (output values.Values, err error)

func (*ApplicationCore) ExecuteFunction

func (core *ApplicationCore) ExecuteFunction(ctx context.Context, key domain.DomainFunctionKey, input interface{}, output interface{}) error

func (*ApplicationCore) GetEntityTypeService

func (core *ApplicationCore) GetEntityTypeService() *DomainDefinitionAccessor

TODO: exposing storage/engine internals directly

func (*ApplicationCore) Open

func (core *ApplicationCore) Open(
	engine *domain.Engine,
	authorizationDecisionProvider AuthorizationDecisionProvider,
	actions map[string]ActionHandler,
)

func (*ApplicationCore) Projections

func (core *ApplicationCore) Projections() *ProjectionsAccessor

type AuthorizationDecisionProvider

type AuthorizationDecisionProvider interface {
	EntityAuthorizationDecisionProvider() EntityAuthorizationDecisionEvaluator

	DomainFunction() DomainFunctionAuthorizationProvider

	ProjectionAccessEvaluator() ProjectionAccessEvaluator
}

type Decision

type Decision interface {
	IsAllowed() bool
}

type DomainDefinitionAccessor

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

func (DomainDefinitionAccessor) EntityType

func (a DomainDefinitionAccessor) EntityType(name entity.Key) (*entity.Definition, error)

func (DomainDefinitionAccessor) EntityTypes

func (a DomainDefinitionAccessor) EntityTypes() []*entity.Definition

func (DomainDefinitionAccessor) Projection

type DomainFunctionAuthorizationProvider

type DomainFunctionAuthorizationProvider interface {
	CheckExecute(ctx context.Context, storage *domain.Engine, key domain.DomainFunctionKey, holder values.Holder) Decision
}

type EntitiesAccessor

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

func (*EntitiesAccessor) Create

func (a *EntitiesAccessor) Create(ctx context.Context, name entity.Key, attrs values.Values) (entity.Instance, error)

func (*EntitiesAccessor) Delete

func (a *EntitiesAccessor) Delete(ctx context.Context, entityTypeName entity.Key, id int64) error

func (*EntitiesAccessor) ExecuteCommand

func (a *EntitiesAccessor) ExecuteCommand(context context.Context, name entity.Key, id int64, key entity.CommandKey, input values.Values) (values.Values, error)

func (*EntitiesAccessor) Find

func (a *EntitiesAccessor) Find(ctx context.Context, query entity.Query) ([]entity.Instance, error)

func (*EntitiesAccessor) FindAll

func (a *EntitiesAccessor) FindAll(ctx context.Context, entityTypeName entity.Key) ([]entity.Instance, error)

func (*EntitiesAccessor) FindByAttributes

func (a *EntitiesAccessor) FindByAttributes(ctx context.Context, entityTypeName entity.Key, attributes values.Values, sortBy []query.OrderClause) ([]entity.Instance, error)

TODO: this is a helper function, which builds entity.Query, maybe a create a specialized factory for entity.Query

func (*EntitiesAccessor) FindByStringValues

func (a *EntitiesAccessor) FindByStringValues(ctx context.Context, entityTypeName entity.Key, strings map[string][]string, orderBy []query.OrderClause) ([]entity.Instance, error)

TODO: this is a helper function, which builds entity.Query, maybe a create a specialized factory for entity.Query

func (*EntitiesAccessor) Get

func (a *EntitiesAccessor) Get(ctx context.Context, entityTypeName entity.Key, entityId int64) (entity.Instance, error)

func (*EntitiesAccessor) GetCommandDefaultInput

func (a *EntitiesAccessor) GetCommandDefaultInput(context context.Context, name entity.Key, id int64, key entity.CommandKey) (values.Holder, error)

func (*EntitiesAccessor) GetRevisions

func (a *EntitiesAccessor) GetRevisions(ctx context.Context, entityTypeName entity.Key, id int64) ([]domain.EntityRevision, error)

type EntityAccessNotAllowedError

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

func (EntityAccessNotAllowedError) Error

func (err EntityAccessNotAllowedError) Error() string

type EntityAuthorizationDecisionEvaluator

type EntityAuthorizationDecisionEvaluator interface {
	EvaluateEntityInstanceAccess(ctx context.Context, reference entity.Reference) Decision
	EvaluateEntityQueryAccess(ctx context.Context, query entity.Query) Decision

	// TODO: there are four subjects for evaluation (context, entity, action, input/message)
	EvaluateEntityActionAccess(ctx context.Context, entity entity.Instance, name string) Decision

	// TODO: there are four subjects for evaluation (context, entity, action, input/message)
	EvaluateEntityTypeActionAccess(ctx context.Context, entityType entity.Key, name string) Decision
}

type ProjectionAccessEvaluator

type ProjectionAccessEvaluator interface {
	// TODO: projection.Reference
	EvaluateProjectionInstanceAccess(ctx context.Context, projectionTypeName string, id int64) Decision
	EvaluateProjectionQueryAccess(ctx context.Context, q projection.Query) Decision
}

type ProjectionAccessNotAllowedError

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

func (ProjectionAccessNotAllowedError) Error

type ProjectionsAccessor

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

func (*ProjectionsAccessor) Find

func (*ProjectionsAccessor) FindAll

func (a *ProjectionsAccessor) FindAll(ctx context.Context, projectionTypeName string) ([]projection.Instance, error)

func (*ProjectionsAccessor) FindByStringValues

func (a *ProjectionsAccessor) FindByStringValues(ctx context.Context, projectionTypeName string, strings map[string][]string, orderBy []query.OrderClause) ([]projection.Instance, error)

func (*ProjectionsAccessor) Get

func (a *ProjectionsAccessor) Get(ctx context.Context, name string, entityId int64) (projection.Instance, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL