predicate

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package predicate provides predicate builders

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Predicate

type Predicate[T any] func(T) bool

Predicate tests value (converts to true or false).

func And

func And[T any](p1, p2 Predicate[T]) Predicate[T]

And makes a conjunction of two predicates

func Eq

func Eq[T comparable](v T) Predicate[T]

Eq creates a predicate to test for equality

func Match

func Match[Entity, Property any](getter func(Entity) Property, condition Predicate[Property]) Predicate[Entity]

Match creates a predicate that tests whether a value of a structure property matches a specified condition

func MatchAny

func MatchAny[Entity, Property any](getter func(Entity) []Property, condition Predicate[Property]) Predicate[Entity]

MatchAny creates a predicate that tests whether any value of a structure property matches a specified condition The property has a slice type.

func Not

func Not[T any](p Predicate[T]) Predicate[T]

Not negates the 'p' predicate

func Or

func Or[T any](p1, p2 Predicate[T]) Predicate[T]

Or makes a disjunction of two predicates

func Union

func Union[T any](predicates ...Predicate[T]) Predicate[T]

Union applies And to predicates

func Xor

func Xor[T any](p1, p2 Predicate[T]) Predicate[T]

Xor makes an exclusive OR of two predicates

func (Predicate[T]) And

func (p Predicate[T]) And(and Predicate[T]) Predicate[T]

And makes conjunction

func (Predicate[T]) Or

func (p Predicate[T]) Or(or Predicate[T]) Predicate[T]

Or makes disjunction

func (Predicate[T]) Xor

func (p Predicate[T]) Xor(xor Predicate[T]) Predicate[T]

Xor makes exclusive OR

Directories

Path Synopsis
Package always provides constant predicate implementations
Package always provides constant predicate implementations
Package eq provides predicate builder short aliases
Package eq provides predicate builder short aliases
Package exclude provides predicate builders
Package exclude provides predicate builders
Package less provides predicate builders
Package less provides predicate builders
Package match provides short predicate constructors
Package match provides short predicate constructors
Package more provides predicate builders
Package more provides predicate builders
Package not provides negalive predicate builders like 'not equals to'
Package not provides negalive predicate builders like 'not equals to'
Package one provides predicate builders
Package one provides predicate builders
Package where provides short predicate constructors
Package where provides short predicate constructors

Jump to

Keyboard shortcuts

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