specification

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 0 Imported by: 0

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]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL