predicate

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package predicate provides breakable 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, error)

Predicate tests value (converts to true or false) or aborts by an error.

func Always

func Always[T any](v bool) Predicate[T]

Always returns v every time.

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 Never

func Never[T any](v bool) Predicate[T]

Never returns the negative of v every time

func Not

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

Not inverts a predicate

func Of

func Of[T comparable](predicate func(T) bool) Predicate[T]

Of breakable Predicate constructor

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 Wrap added in v0.0.9

func Wrap[T any](predicate func(T) bool) Predicate[T]

Wrap converts the specified predicate to the erroreable one

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 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

Jump to

Keyboard shortcuts

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