boolean

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package boolean Boolean expressions evaluate their argument expressions as booleans and return a boolean as the result. In addition to the false boolean value, Boolean expression evaluates as false the following: null, 0, and undefined values. The Boolean expression evaluates all other values as true, including non-zero numeric values and arrays.

Index

Constants

This section is empty.

Variables

View Source
var (
	OR  = NewOperator("$or", "Or")
	NOR = NewOperator("$nor", "Nor")
)
View Source
var (
	DBREFKeys = []string{
		"$ref",
		"$id",
	}
	DBREFKeysWithDb = []string{
		"$ref",
		"$id",
		"$db",
	}
)

Functions

func And

func And[T expression.AnyExpression](filters ...T) booleanOperator

And Evaluates one or more expressions and returns true if all of the expressions are true or if run with no argument expressions. Otherwise, $and returns false.

func NewAddFilter

func NewAddFilter[T expression.AnyExpression](filters []T) addFilter[T]

func NewNotFilter

func NewNotFilter[T expression.AnyExpression](value T) notFilter[T]

func NewOrNorFilter

func NewOrNorFilter[T expression.AnyExpression](operator Operator, filters []T) orNorFilter[T]

func Nor

func Nor[T expression.AnyExpression](filters ...T) booleanOperator

Nor Evaluates one or more expressions and returns true if any of the expressions are true. Otherwise, $or returns false. $or has the following syntax: { $or: [ <expression1>, <expression2>, ... ] }

func Not

func Not[T expression.AnyExpression](f T) booleanOperator

Not Evaluates a boolean and returns the opposite boolean value; i.e. when passed an expression that evaluates to true, $not returns false; when passed an expression that evaluates to false, $not returns true. $not has the following syntax: { $not: [ <expression> ] }

func Or

func Or[T expression.AnyExpression](filters ...T) booleanOperator

Or Evaluates one or more expressions and returns true if any of the expressions are true. Otherwise, $or returns false. $or has the following syntax: { $or: [ <expression1>, <expression2>, ... ] }

Types

type Operator

type Operator struct {
	// contains filtered or unexported fields
}

func NewOperator

func NewOperator(name string, toStringName string) Operator

Jump to

Keyboard shortcuts

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