Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 And ¶
func And[T any](left Specification[T], right Specification[T]) Specification[T]
func New ¶
func New[T any](isSatisfiedBy func(t T) bool) Specification[T]
func Not ¶
func Not[T any](spec Specification[T]) Specification[T]
func Or ¶
func Or[T any](left Specification[T], right Specification[T]) Specification[T]
Click to show internal directories.
Click to hide internal directories.