Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
func Filter[T any](list []*T, spec Specification[T]) ([]*T, error)
Filter returns a new slice containing only the elements that satisfy the given specification.
Types ¶
type AndSpecification ¶
type AndSpecification[T any] struct { // contains filtered or unexported fields }
AndSpecification is a composite specification that represents the logical AND of two other specifications.
func NewAndSpecification ¶
func NewAndSpecification[T any](specs ...Specification[T]) *AndSpecification[T]
func (*AndSpecification[T]) IsSatisfiedBy ¶
func (a *AndSpecification[T]) IsSatisfiedBy(account *T) error
type NotSpecification ¶
type NotSpecification[T any] struct { // contains filtered or unexported fields }
NotSpecification is a composite specification that represents the logical NOT of another specification.
func NewNotSpecification ¶
func NewNotSpecification[T any](spec Specification[T]) *NotSpecification[T]
func (*NotSpecification[T]) IsSatisfiedBy ¶
func (n *NotSpecification[T]) IsSatisfiedBy(account *T) error
type OrSpecification ¶
type OrSpecification[T any] struct { // contains filtered or unexported fields }
OrSpecification is a composite specification that represents the logical OR of two other specifications.
func NewOrSpecification ¶
func NewOrSpecification[T any](specs ...Specification[T]) *OrSpecification[T]
func (*OrSpecification[T]) IsSatisfiedBy ¶
func (o *OrSpecification[T]) IsSatisfiedBy(account *T) error
type Specification ¶
Specification is the interface that wraps the IsSatisfiedBy method.
Click to show internal directories.
Click to hide internal directories.