predicate

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: LGPL-3.0 Imports: 4 Imported by: 0

README

Predicate

Predicate is a simple library for evaluating predicates (boolean functions) and getting a textual representation of them.

Documentation

Index

Constants

View Source
const (
	NotOp          = "¬"
	AndOp          = "∧"
	OrOp           = "∨"
	EquivalesOp    = "≡"
	NotEquivalesOp = "≢"
	ImpliesOp      = "⇒"
	Term           = "term"
)
View Source
const (
	OperandAK = "a"
	OperandBK = "b"
	StrK      = "str"
)

Variables

This section is empty.

Functions

func String

func String(p *Predicate) (r string)

Types

type NameBool added in v0.0.3

type NameBool func(string) (bool, bool)

type Predicate

type Predicate struct {
	Operator string     `json:"operator"`
	A        *Predicate `json:"a"`
	B        *Predicate `json:"b"`
	String   string     `json:"string"`
}

func False

func False() (r *Predicate)

func NewTerm added in v0.0.2

func NewTerm(s string) (p *Predicate)

func Parse added in v0.0.2

func Parse(source io.Reader) (p *Predicate, e error)

func Reduce

func Reduce(p *Predicate, interp NameBool) (r *Predicate)

func True

func True() (r *Predicate)

func (*Predicate) From

func (p *Predicate) From(m map[string]interface{},
	f func(string) (func() (bool, bool), func() string)) (e error)

func (*Predicate) To

func (p *Predicate) To() (m map[string]interface{})

func (*Predicate) Valid added in v0.0.2

func (p *Predicate) Valid() (ok bool)

Jump to

Keyboard shortcuts

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