Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AndSpecification ¶
type AndSpecification[T any] struct { // contains filtered or unexported fields }
AndSpecification used to create a new specification that is the AND of two other specifications.
func NewAndSpecification ¶
func NewAndSpecification[T any](left Specification[T], right Specification[T]) *AndSpecification[T]
func (*AndSpecification) And ¶
func (spec *AndSpecification) And(another Specification[T]) Specification[T]
func (*AndSpecification[T]) IsSatisfiedBy ¶
func (spec *AndSpecification[T]) IsSatisfiedBy(t T) bool
func (*AndSpecification) Not ¶
func (spec *AndSpecification) Not(another Specification[T]) Specification[T]
func (*AndSpecification) Or ¶
func (spec *AndSpecification) Or(another Specification[T]) Specification[T]
type DomainEvent ¶
DomainEvent is something that is unique, but does not have a lifecycle. The identity may be explicit, for example the sequence number of a payment, or it could be derived from various aspects of the event such as where, when and what has happened.
type NotSpecification ¶
type NotSpecification[T any] struct { // contains filtered or unexported fields }
NotSpecification used to create a new specification that is the inverse (NOT) of the given spec.
func NewNotSpecification ¶
func NewNotSpecification[T any](spec Specification[T]) *NotSpecification[T]
func (*NotSpecification) And ¶
func (spec *NotSpecification) And(another Specification[T]) Specification[T]
func (*NotSpecification[T]) IsSatisfiedBy ¶
func (spec *NotSpecification[T]) IsSatisfiedBy(t T) bool
func (*NotSpecification) Not ¶
func (spec *NotSpecification) Not(another Specification[T]) Specification[T]
func (*NotSpecification) Or ¶
func (spec *NotSpecification) Or(another Specification[T]) Specification[T]
type OrSpecification ¶
type OrSpecification[T any] struct { // contains filtered or unexported fields }
OrSpecification used to create a new specification that is the OR of two other specifications.
func NewOrSpecification ¶
func NewOrSpecification[T any](left Specification[T], right Specification[T]) *OrSpecification[T]
func (*OrSpecification) And ¶
func (spec *OrSpecification) And(another Specification[T]) Specification[T]
func (*OrSpecification[T]) IsSatisfiedBy ¶
func (spec *OrSpecification[T]) IsSatisfiedBy(t T) bool
func (*OrSpecification) Not ¶
func (spec *OrSpecification) Not(another Specification[T]) Specification[T]
func (*OrSpecification) Or ¶
func (spec *OrSpecification) Or(another Specification[T]) Specification[T]
type Specification ¶
type Specification[T any] interface { // IsSatisfiedBy check if t is satisfied by the specification. IsSatisfiedBy(t T) bool // And create a new specification that is the AND operation of the current specification and // another specification. And(another Specification[T]) Specification[T] // Or create a new specification that is the OR operation of the current specification and // another specification. Or(another Specification[T]) Specification[T] // Not create a new specification that is the NOT operation of the current specification. Not(another Specification[T]) Specification[T] }
Specification interface. Use BaseSpecification as base for creating specifications, and only the method isSatisfiedBy(Object) must be implemented.
func NewSpecification ¶
func NewSpecification[T any](isSatisfiedBy func(t T) bool) Specification[T]
type ValueObject ¶
ValueObject as described in the DDD book. Value objects compare by the values of their attributes, they don't have an identity.