Documentation
¶
Overview ¶
Package goexpr provides basic expression evaluation of Go. It supports values of the following types: bool, byte, uint16, uint32, uint64, int8, int16, int32, int64, int, float32, float64, string and time.Time.
Index ¶
- type ArrayExpr
- type ArrayList
- type Expr
- func Any(exprs ...Expr) Expr
- func Array(items ...Expr) Expr
- func Binary(operator string, left Expr, right Expr) (Expr, error)
- func Boolean(operator string, left Expr, right Expr) (Expr, error)
- func Concat(exprs ...Expr) Expr
- func Constant(val interface{}) Expr
- func Decode(exprs ...Expr) Expr
- func In(val Expr, candidates List) Expr
- func Len(source Expr) Expr
- func Not(wrapped Expr) Expr
- func P(wrapped Expr) Expr
- func Param(name string) Expr
- func Rand() Expr
- func ReplaceAll(source Expr, regex Expr, replacement Expr) Expr
- func Split(source Expr, delim Expr, idx Expr) Expr
- func Substr(source Expr, from Expr, length Expr) Expr
- type List
- type MapParams
- type Params
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayExpr ¶
type ArrayExpr struct {
Items []Expr
}
ArrayExpr is just a placeholder expression for grouping some other expressions together.
func (*ArrayExpr) WalkOneToOneParams ¶
func (*ArrayExpr) WalkParams ¶
type Expr ¶
type Expr interface { Eval(Params) interface{} // WalkParams supplies the callback with the names of any params referenced by // this expression. WalkParams(cb func(string)) // WalkOneToOneParams supplies the callback with the names of any params whose // values are transformed by this expression on a one-to-one basis (i.e. every // input value corresponds to one distinct output value). WalkOneToOneParams(cb func(string)) WalkLists(cb func(List)) String() string }
func Any ¶
Any is an expression that returns the first non-nil, non-empty string value from evaluating the exprs.
func Boolean ¶
Boolean accepts the operators AND, OR and returns a short-circuiting expression that evaluates left first and right second.
func Decode ¶
Decode compares the value of the first expression to a series of key/value pairs and returns the matching value. It optionally takes a final default value to use if none of the keys match.
func Len ¶
Len calculates the length of the string representation of the given value. If value is nil, returns nil.
func ReplaceAll ¶
ReplaceAll replaces all occurrences of the regex with the replacement.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
This program generates the type switch statements needed by goexpr to implement type casting
|
This program generates the type switch statements needed by goexpr to implement type casting |
Package geo provides geolocation functions.
|
Package geo provides geolocation functions. |
Package isp provides isp lookup functions for IPv4 addresses
|
Package isp provides isp lookup functions for IPv4 addresses |