Documentation
¶
Index ¶
- type Specification
- func And[T any](left Specification[T], right Specification[T]) Specification[T]
- func Conjunction[T any](specs ...Specification[T]) Specification[T]
- func Disjunction[T any](specs ...Specification[T]) Specification[T]
- func New[T any](predicate func(ctx context.Context, t T) bool) Specification[T]
- func Not[T any](spec Specification[T]) Specification[T]
- func Or[T any](left Specification[T], right Specification[T]) Specification[T]
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(ctx context.Context, 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] // Conjunction create a new specification that is conjunction operation of the current specification. Conjunction(others ...Specification[T]) Specification[T] // Disjunction create a new specification that is disjunction operation of the current specification. Disjunction(others ...Specification[T]) Specification[T] }
Specification interface. Use specification as specification for creating specifications, and only the method predicate(Object) must be implemented.
func And ¶
func And[T any](left Specification[T], right Specification[T]) Specification[T]
func Conjunction ¶ added in v1.3.2
func Conjunction[T any](specs ...Specification[T]) Specification[T]
func Disjunction ¶ added in v1.3.2
func Disjunction[T any](specs ...Specification[T]) 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.