Documentation
¶
Overview ¶
Package service is the service tier: a Base, built from the service's contract, is the embeddable core of a consumer's service, running its custom operations through the tier's decoration (Tier) with the promoted Exec. An Entity (entity.go) is a Base that also serves an entity's roles over its repository.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Base ¶ added in v0.0.7
Base is the embeddable core of a service named by its Subject: Name and Exec run a domain operation through the tier's decoration. Each operation is a method of the service's contract, decorated under its own name. The zero Base runs operations undecorated.
func NewBase ¶ added in v0.0.7
NewBase builds the Base for the service named name whose operations are the methods of its contract S (an interface), decorated from decs: the service as the service-tier component name, and each operation op as name+"."+op. A contract that is not an interface, or a decoration that fails to resolve, is an error.
type Entity ¶ added in v0.0.16
type Entity[T, P any, ID comparable, N any] struct { // Entity serves the roles. decorate.Entity[T, P, ID] // Base runs the service's operations and supplies Name and Exec. Base // contains filtered or unexported fields }
Entity is the service-tier entity base: a Base that also serves the entity's roles over N, the next tier's contract (a repository), checking each entity Create, Update and Upsert write with the service's validator. A service embeds it and adds its domain operations through Exec, calling Next; an override of a role calls Next, never the role it shadows.
func NewEntity ¶ added in v0.0.16
func NewEntity[S, T, P any, ID comparable, N any]( decs decorate.Decorations, name string, next N, validate func(*T) error, ) (Entity[T, P, ID, N], error)
NewEntity builds the Entity of the service named name over next, whose contract is S (an interface), serving the roles S has from next's methods and rejecting a written entity validate refuses (nil accepts every entity): decorated as NewBase decorates. A role S names that next lacks is CodeInternal.