funcs

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Package funcs contains implementations of functions for the expressions as well as utility functions for those functions.

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Code generated by funcs-gen. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolVar

func BoolVar() *varBool

BoolVar returns a variable of type Bool

func BytesVar

func BytesVar() *varBytes

BytesVar returns a variable of type Bytes

func DoubleVar

func DoubleVar() *varDouble

DoubleVar returns a variable of type Double

func Equal

func Equal(l, r Comparable) bool

Equal returns whether two functions are equal.

func Hash

func Hash(name string, hs ...Hashable) uint64

Hash calculates a hash for a function, given a name and its parameters.

func IntVar

func IntVar() *varInt

IntVar returns a variable of type Int

func IsConst

func IsConst(typ reflect.Type) bool

IsConst returns whether a reflected type is a function that is actually a constant value.

func IsFalse

func IsFalse(fn Bool) bool

IsFalse returns whether a function is a false constant.

func IsSimpleEqual

func IsSimpleEqual(f Bool) bool

IsSimpleEqual returns whether the input function is a simple equal expression, where one argument is a constant and the other is a variable.

func IsTrue

func IsTrue(fn Bool) bool

IsTrue returns whether a function is a true constant.

func Register

func Register(name string, fnc interface{})

Register registers a function as function that can composed.

func Sprint

func Sprint(s Stringer) string

Sprint returns the string printout of the function.

func StringVar

func StringVar() *varString

StringVar returns a variable of type String

func UintVar

func UintVar() *varUint

UintVar returns a variable of type Uint

Types

type Bool

type Bool interface {
	Func
	Eval() (bool, error)
}

Bool is an interface that represents a function that returns a bool.

func And

func And(v1, v2 Bool) Bool

And returns a new and function with the two input functions as its parameters.

func BoolEq

func BoolEq(a, b Bool) Bool

BoolEq returns a new equal function.

func BoolNe

func BoolNe(a, b Bool) Bool

BoolNe returns a new not equal function.

func BytesEq

func BytesEq(a, b Bytes) Bool

BytesEq returns a new equal function.

func BytesGE

func BytesGE(a, b Bytes) Bool

BytesGE returns a new greater than or equal function.

func BytesGt

func BytesGt(a, b Bytes) Bool

BytesGt returns a new greater than function.

func BytesLE

func BytesLE(a, b Bytes) Bool

BytesLE returns a new less than or equal function.

func BytesLt

func BytesLt(a, b Bytes) Bool

BytesLt returns a new less than function.

func BytesNe

func BytesNe(a, b Bytes) Bool

BytesNe returns a new not equal function.

func Contains

func Contains(s, sub String) Bool

Contains returns a contains function with the two input function as its parameter.

func ContainsInt

func ContainsInt(element Int, list ConstInts) (Bool, error)

ContainsInt returns a function that checks whether the element is contained in the list.

func ContainsString

func ContainsString(element String, list ConstStrings) (Bool, error)

ContainsString returns a function that checks whether the element is contained in the list.

func ContainsUint

func ContainsUint(element Uint, list ConstUints) (Bool, error)

ContainsUint returns a function that checks whether the element is contained in the list.

func DoubleEq

func DoubleEq(a, b Double) Bool

DoubleEq returns a new equal function.

func DoubleGE

func DoubleGE(a, b Double) Bool

DoubleGE returns a new greater than or equal function.

func DoubleGt

func DoubleGt(a, b Double) Bool

DoubleGt returns a new greater than function.

func DoubleLE

func DoubleLE(a, b Double) Bool

DoubleLE returns a new less than or equal function.

func DoubleLt

func DoubleLt(a, b Double) Bool

DoubleLt returns a new less than function.

func DoubleNe

func DoubleNe(a, b Double) Bool

DoubleNe returns a new not equal function.

func ElemBools

func ElemBools(list Bools, n Int) Bool

ElemBools returns a function that returns the n'th element of the list.

func EqualFold

func EqualFold(s, t String) Bool

EqualFold returns a eqFold function with the two input functions as its parameters.

func HasPrefix

func HasPrefix(a, b String) Bool

HasPrefix returns a hasPrefix function with the two input functions as its parameters.

func HasSuffix

func HasSuffix(a, b String) Bool

HasSuffix returns a hasSuffix function with the two input functions as its parameters.

func IntEq

func IntEq(a, b Int) Bool

IntEq returns a new equal function.

func IntGE

func IntGE(a, b Int) Bool

IntGE returns a new greater than or equal function.

func IntGt

func IntGt(a, b Int) Bool

IntGt returns a new greater than function.

func IntLE

func IntLE(a, b Int) Bool

IntLE returns a new less than or equal function.

func IntLt

func IntLt(a, b Int) Bool

IntLt returns a new less than function.

func IntNe

func IntNe(a, b Int) Bool

IntNe returns a new not equal function.

func Not

func Not(v1 Bool) Bool

Not returns a new not function with the input function as its parameter.

func Or

func Or(v1, v2 Bool) Bool

Or returns a new or function with the two input functions as its parameters.

func PrintBool

func PrintBool(e Bool) Bool

PrintBool returns a function that prints out the value of the argument function and returns its value.

func Regex

func Regex(expr ConstString, input String) (Bool, error)

Regex returns a new regex function given the first parameter as the expression string that needs to compiled and the second as the regex that should be matched.

func StringEq

func StringEq(a, b String) Bool

StringEq returns a new equal function.

func StringNe

func StringNe(a, b String) Bool

StringNe returns a new not equal function.

func TrimBool

func TrimBool(f Bool) Bool

TrimBool turns functions into constants, if they can be evaluated at compile time.

func TypeBool

func TypeBool(v Bool) Bool

TypeBool returns a function that returns true if the error returned by the argument function is nil.

func TypeBytes

func TypeBytes(v Bytes) Bool

TypeBytes returns a function that returns true if the error returned by the argument function is nil.

func TypeDouble

func TypeDouble(v Double) Bool

TypeDouble returns a function that returns true if the error returned by the argument function is nil.

func TypeInt

func TypeInt(v Int) Bool

TypeInt returns a function that returns true if the error returned by the argument function is nil.

func TypeString

func TypeString(v String) Bool

TypeString returns a function that returns true if the error returned by the argument function is nil.

func TypeUint

func TypeUint(v Uint) Bool

TypeUint returns a function that returns true if the error returned by the argument function is nil.

func UintEq

func UintEq(a, b Uint) Bool

UintEq returns a new equal function.

func UintGE

func UintGE(a, b Uint) Bool

UintGE returns a new greater than or equal function.

func UintGt

func UintGt(a, b Uint) Bool

UintGt returns a new greater than function.

func UintLE

func UintLE(a, b Uint) Bool

UintLE returns a new less than or equal function.

func UintLt

func UintLt(a, b Uint) Bool

UintLt returns a new less than function.

func UintNe

func UintNe(a, b Uint) Bool

UintNe returns a new not equal function.

type Bools

type Bools interface {
	Func
	Eval() ([]bool, error)
}

Bools is an interface that represents a function that returns a list of bools.

func NewListOfBool

func NewListOfBool(v []Bool) Bools

NewListOfBool returns a new function that when evaluated returns a list of type Bool

func PrintBools

func PrintBools(e Bools) Bools

PrintBools returns a function that prints out the value of the argument function and returns its value.

func RangeBools

func RangeBools(list Bools, from, to Int) Bools

RangeBools returns a function that returns a range of elements from a list.

func TrimBools

func TrimBools(f Bools) Bools

TrimBools turns functions into constants, if they can be evaluated at compile time.

type Bytes

type Bytes interface {
	Func
	Eval() ([]byte, error)
}

Bytes is an interface that represents a function that returns []byte.

func ElemListOfBytes

func ElemListOfBytes(list ListOfBytes, n Int) Bytes

ElemListOfBytes returns a function that returns the n'th element of the list.

func PrintBytes

func PrintBytes(e Bytes) Bytes

PrintBytes returns a function that prints out the value of the argument function and returns its value.

func TrimBytes

func TrimBytes(f Bytes) Bytes

TrimBytes turns functions into constants, if they can be evaluated at compile time.

type Comparable

type Comparable interface {
	Compare(Comparable) int
	Hashable
	Stringer
}

type Const

type Const interface {
	IsConst()
}

Const is an interface that when implemented implies that the function is actually a constant value.

type ConstBool

type ConstBool interface {
	Bool
}

func BoolConst

func BoolConst(v bool) ConstBool

BoolConst returns a new constant function of type Bool

type ConstBools

type ConstBools interface {
	Bools
}

func BoolsConst

func BoolsConst(v []bool) ConstBools

BoolsConst returns a new constant function of type Bools

type ConstBytes

type ConstBytes interface {
	Bytes
}

func BytesConst

func BytesConst(v []byte) ConstBytes

BytesConst returns a new constant function of type Bytes

type ConstDouble

type ConstDouble interface {
	Double
}

func DoubleConst

func DoubleConst(v float64) ConstDouble

DoubleConst returns a new constant function of type Double

type ConstDoubles

type ConstDoubles interface {
	Doubles
}

func DoublesConst

func DoublesConst(v []float64) ConstDoubles

DoublesConst returns a new constant function of type Doubles

type ConstInt

type ConstInt interface {
	Int
}

func IntConst

func IntConst(v int64) ConstInt

IntConst returns a new constant function of type Int

type ConstInts

type ConstInts interface {
	Ints
}

func IntsConst

func IntsConst(v []int64) ConstInts

IntsConst returns a new constant function of type Ints

type ConstListOfBytes

type ConstListOfBytes interface {
	ListOfBytes
}

func ListOfBytesConst

func ListOfBytesConst(v [][]byte) ConstListOfBytes

ListOfBytesConst returns a new constant function of type ListOfBytes

type ConstString

type ConstString interface {
	String
}

func StringConst

func StringConst(v string) ConstString

StringConst returns a new constant function of type String

type ConstStrings

type ConstStrings interface {
	Strings
}

func StringsConst

func StringsConst(v []string) ConstStrings

StringsConst returns a new constant function of type Strings

type ConstUint

type ConstUint interface {
	Uint
}

func UintConst

func UintConst(v uint64) ConstUint

UintConst returns a new constant function of type Uint

type ConstUints

type ConstUints interface {
	Uints
}

func UintsConst

func UintsConst(v []uint64) ConstUints

UintsConst returns a new constant function of type Uints

type Context

type Context struct {
	Value interface{}
}

type Double

type Double interface {
	Func
	Eval() (float64, error)
}

Double is an interface that represents a function that returns a double.

func ElemDoubles

func ElemDoubles(list Doubles, n Int) Double

ElemDoubles returns a function that returns the n'th element of the list.

func PrintDouble

func PrintDouble(e Double) Double

PrintDouble returns a function that prints out the value of the argument function and returns its value.

func TrimDouble

func TrimDouble(f Double) Double

TrimDouble turns functions into constants, if they can be evaluated at compile time.

type Doubles

type Doubles interface {
	Func
	Eval() ([]float64, error)
}

Doubles is an interface that represents a function that returns a list of doubles.

func NewListOfDouble

func NewListOfDouble(v []Double) Doubles

NewListOfDouble returns a new function that when evaluated returns a list of type Double

func PrintDoubles

func PrintDoubles(e Doubles) Doubles

PrintDoubles returns a function that prints out the value of the argument function and returns its value.

func RangeDoubles

func RangeDoubles(list Doubles, from, to Int) Doubles

RangeDoubles returns a function that returns a range of elements from a list.

func TrimDoubles

func TrimDoubles(f Doubles) Doubles

TrimDoubles turns functions into constants, if they can be evaluated at compile time.

type ErrContainsListNotConst

type ErrContainsListNotConst struct{}

func (ErrContainsListNotConst) Error

type ErrNotBoolConst

type ErrNotBoolConst struct{}

func (ErrNotBoolConst) Error

func (this ErrNotBoolConst) Error() string

type ErrNotBytesConst

type ErrNotBytesConst struct{}

func (ErrNotBytesConst) Error

func (this ErrNotBytesConst) Error() string

type ErrNotDoubleConst

type ErrNotDoubleConst struct{}

func (ErrNotDoubleConst) Error

func (this ErrNotDoubleConst) Error() string

type ErrNotIntConst

type ErrNotIntConst struct{}

func (ErrNotIntConst) Error

func (this ErrNotIntConst) Error() string

type ErrNotStringConst

type ErrNotStringConst struct{}

func (ErrNotStringConst) Error

func (this ErrNotStringConst) Error() string

type ErrNotUintConst

type ErrNotUintConst struct{}

func (ErrNotUintConst) Error

func (this ErrNotUintConst) Error() string

type ErrRange

type ErrRange struct {
	First int
	Last  int
}

ErrRange specifies a range error that tried to slice a list where the first specified index is bigger than the last specified index.

func NewRangeErr

func NewRangeErr(first, last int) ErrRange

NewRangeErr returns a range error

func (ErrRange) Error

func (this ErrRange) Error() string

type ErrRangeCheck

type ErrRangeCheck struct {
	Index int
	Len   int
}

ErrRangeCheck specifies a range check error that resulted while trying to access an element in a list.

func NewRangeCheckErr

func NewRangeCheckErr(index, l int) ErrRangeCheck

NewRangeCheckErr returns a range check error

func (ErrRangeCheck) Error

func (this ErrRangeCheck) Error() string

type Factory

type Factory map[string][]*Maker

type Func

type Func interface {
	Comparable
	HasVariable() bool
}

type Hashable

type Hashable interface {
	Hash() uint64
}

type Int

type Int interface {
	Func
	Eval() (int64, error)
}

Int is an interface that represents a function that returns an int.

func ElemInts

func ElemInts(list Ints, n Int) Int

ElemInts returns a function that returns the n'th element of the list.

func LenBools

func LenBools(e Bools) Int

LenBools returns a function that returns the length of a list of type Bools

func LenBytes

func LenBytes(e Bytes) Int

LenBytes returns a function that returns the length of a list of type Bytes

func LenDoubles

func LenDoubles(e Doubles) Int

LenDoubles returns a function that returns the length of a list of type Doubles

func LenInts

func LenInts(e Ints) Int

LenInts returns a function that returns the length of a list of type Ints

func LenListOfBytes

func LenListOfBytes(e ListOfBytes) Int

LenListOfBytes returns a function that returns the length of a list of type ListOfBytes

func LenString

func LenString(e String) Int

LenString returns a function that returns the length of a list of type String

func LenStrings

func LenStrings(e Strings) Int

LenStrings returns a function that returns the length of a list of type Strings

func LenUints

func LenUints(e Uints) Int

LenUints returns a function that returns the length of a list of type Uints

func Now

func Now() Int

Now returns a new now function.

func PrintInt

func PrintInt(e Int) Int

PrintInt returns a function that prints out the value of the argument function and returns its value.

func TrimInt

func TrimInt(f Int) Int

TrimInt turns functions into constants, if they can be evaluated at compile time.

type Ints

type Ints interface {
	Func
	Eval() ([]int64, error)
}

Ints is an interface that represents a function that returns a list of ints.

func NewListOfInt

func NewListOfInt(v []Int) Ints

NewListOfInt returns a new function that when evaluated returns a list of type Int

func PrintInts

func PrintInts(e Ints) Ints

PrintInts returns a function that prints out the value of the argument function and returns its value.

func RangeInts

func RangeInts(list Ints, from, to Int) Ints

RangeInts returns a function that returns a range of elements from a list.

func TrimInts

func TrimInts(f Ints) Ints

TrimInts turns functions into constants, if they can be evaluated at compile time.

type ListOf

type ListOf interface {
	IsListOf()
}

ListOf is an interface that when implemented specifies that this function does not only return a typed list, but is a typed list.

type ListOfBytes

type ListOfBytes interface {
	Func
	Eval() ([][]byte, error)
}

ListOfBytes is an interface that represents a function that returns a list of []byte.

func NewListOfBytes

func NewListOfBytes(v []Bytes) ListOfBytes

NewListOfBytes returns a new function that when evaluated returns a list of type Bytes

func PrintListOfBytes

func PrintListOfBytes(e ListOfBytes) ListOfBytes

PrintListOfBytes returns a function that prints out the value of the argument function and returns its value.

func RangeListOfBytes

func RangeListOfBytes(list ListOfBytes, from, to Int) ListOfBytes

RangeListOfBytes returns a function that returns a range of elements from a list.

func TrimListOfBytes

func TrimListOfBytes(f ListOfBytes) ListOfBytes

TrimListOfBytes turns functions into constants, if they can be evaluated at compile time.

type Maker

type Maker struct {
	Name    string
	In      []types.Type
	InConst []bool
	Out     types.Type
	// contains filtered or unexported fields
}

func GetMaker

func GetMaker(name string, ins ...types.Type) (*Maker, error)

Which returns the Funk (function creator) of the function given the function name and parameter types.

func (*Maker) New

func (f *Maker) New(values ...interface{}) (interface{}, error)

func (*Maker) NewBool

func (f *Maker) NewBool(values ...interface{}) (Bool, error)

NewBool dynamically creates and asserts the returning function is of type Bool. This function is used by the compose library to compile functions together.

func (*Maker) NewBools

func (f *Maker) NewBools(values ...interface{}) (Bools, error)

NewBools dynamically creates and asserts the returning function is of type Bools. This function is used by the compose library to compile functions together.

func (*Maker) NewBytes

func (f *Maker) NewBytes(values ...interface{}) (Bytes, error)

NewBytes dynamically creates and asserts the returning function is of type Bytes. This function is used by the compose library to compile functions together.

func (*Maker) NewDouble

func (f *Maker) NewDouble(values ...interface{}) (Double, error)

NewDouble dynamically creates and asserts the returning function is of type Double. This function is used by the compose library to compile functions together.

func (*Maker) NewDoubles

func (f *Maker) NewDoubles(values ...interface{}) (Doubles, error)

NewDoubles dynamically creates and asserts the returning function is of type Doubles. This function is used by the compose library to compile functions together.

func (*Maker) NewInt

func (f *Maker) NewInt(values ...interface{}) (Int, error)

NewInt dynamically creates and asserts the returning function is of type Int. This function is used by the compose library to compile functions together.

func (*Maker) NewInts

func (f *Maker) NewInts(values ...interface{}) (Ints, error)

NewInts dynamically creates and asserts the returning function is of type Ints. This function is used by the compose library to compile functions together.

func (*Maker) NewListOfBytes

func (f *Maker) NewListOfBytes(values ...interface{}) (ListOfBytes, error)

NewListOfBytes dynamically creates and asserts the returning function is of type ListOfBytes. This function is used by the compose library to compile functions together.

func (*Maker) NewString

func (f *Maker) NewString(values ...interface{}) (String, error)

NewString dynamically creates and asserts the returning function is of type String. This function is used by the compose library to compile functions together.

func (*Maker) NewStrings

func (f *Maker) NewStrings(values ...interface{}) (Strings, error)

NewStrings dynamically creates and asserts the returning function is of type Strings. This function is used by the compose library to compile functions together.

func (*Maker) NewUint

func (f *Maker) NewUint(values ...interface{}) (Uint, error)

NewUint dynamically creates and asserts the returning function is of type Uint. This function is used by the compose library to compile functions together.

func (*Maker) NewUints

func (f *Maker) NewUints(values ...interface{}) (Uints, error)

NewUints dynamically creates and asserts the returning function is of type Uints. This function is used by the compose library to compile functions together.

func (*Maker) String

func (this *Maker) String() string

type SetContext

type SetContext interface {
	SetContext(*Context)
}

type Setter

type Setter interface {
	SetValue(parser.Value)
}

Setter is an interface that represents a variable of which the value must be set.

type String

type String interface {
	Func
	Eval() (string, error)
}

String is an interface that represents a function that returns a string.

func ElemStrings

func ElemStrings(list Strings, n Int) String

ElemStrings returns a function that returns the n'th element of the list.

func PrintString

func PrintString(e String) String

PrintString returns a function that prints out the value of the argument function and returns its value.

func ToLower

func ToLower(s String) String

ToLower returns a toLower function with the input function as its parameter.

func ToUpper

func ToUpper(s String) String

ToUpper returns a toUpper function with the input function as its parameter.

func TrimString

func TrimString(f String) String

TrimString turns functions into constants, if they can be evaluated at compile time.

type Stringer

type Stringer interface {
	String() string
}

type Strings

type Strings interface {
	Func
	Eval() ([]string, error)
}

Strings is an interface that represents a function that returns a list of strings.

func NewListOfString

func NewListOfString(v []String) Strings

NewListOfString returns a new function that when evaluated returns a list of type String

func PrintStrings

func PrintStrings(e Strings) Strings

PrintStrings returns a function that prints out the value of the argument function and returns its value.

func RangeStrings

func RangeStrings(list Strings, from, to Int) Strings

RangeStrings returns a function that returns a range of elements from a list.

func TrimStrings

func TrimStrings(f Strings) Strings

TrimStrings turns functions into constants, if they can be evaluated at compile time.

type Uint

type Uint interface {
	Func
	Eval() (uint64, error)
}

Uint is an interface that represents a function that returns a uint.

func ElemUints

func ElemUints(list Uints, n Int) Uint

ElemUints returns a function that returns the n'th element of the list.

func PrintUint

func PrintUint(e Uint) Uint

PrintUint returns a function that prints out the value of the argument function and returns its value.

func TrimUint

func TrimUint(f Uint) Uint

TrimUint turns functions into constants, if they can be evaluated at compile time.

type Uints

type Uints interface {
	Func
	Eval() ([]uint64, error)
}

Uints is an interface that represents a function that returns a list of uints.

func NewListOfUint

func NewListOfUint(v []Uint) Uints

NewListOfUint returns a new function that when evaluated returns a list of type Uint

func PrintUints

func PrintUints(e Uints) Uints

PrintUints returns a function that prints out the value of the argument function and returns its value.

func RangeUints

func RangeUints(list Uints, from, to Int) Uints

RangeUints returns a function that returns a range of elements from a list.

func TrimUints

func TrimUints(f Uints) Uints

TrimUints turns functions into constants, if they can be evaluated at compile time.

Directories

Path Synopsis
Command funcs-gen generates some of the code in the funcs package.
Command funcs-gen generates some of the code in the funcs package.

Jump to

Keyboard shortcuts

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