Documentation ¶
Index ¶
- Variables
- func AssertEqual(t *testing.T, a interface{}, b interface{}, message ...string)
- func AssertNotEqual(t *testing.T, a interface{}, b interface{}, message ...string)
- func GetDateKeywords(t time.Time) map[string]interface{}
- func GetValidDayNames() []string
- func IsInvalidNumber(input interface{}) bool
- func Process(langEval gval.Language, expression string, variables map[string]interface{}) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // LangEval is a custom GVal evaluator for business rules and facts conditions // It contains all supported custom functions (math, date, dateopendays, etc.) LangEval = gval.NewLanguage( gval.Full(), LangExprMath, LangEvalDate, LangEvalDateOpenDays, LangAdvancedInfix, LangEvalMap, LangEvalString, LangEvalSlice, LangEvalUrl, ) // LangExprMath is a custom GVal evaluator for business rules and facts conditions // It contains custom functions related to math LangExprMath = gval.NewLanguage( gval.Full(), gval.Function("length", length), gval.Function("max", mathMax), gval.Function("min", mathMin), gval.Function("sum", sum), gval.Function("average", average), gval.Function("roundToDecimal", roundToDecimal), gval.Function("safeDivide", safeDivide), ) // LangEvalDate is a custom GVal evaluator for business rules and facts conditions // It contains custom functions related to date LangEvalDate = gval.NewLanguage( gval.Full(), gval.Function("dayOfWeek", dayOfWeek), gval.Function("day", day), gval.Function("month", month), gval.Function("year", year), gval.Function("startOf", startOf), gval.Function("endOf", endOf), gval.Function("datemillis", dateToMillis), gval.Function("calendar_add", addDurationDays), gval.Function("calendar_delay", delayInDays), gval.Function("truncate_date", truncateDate), gval.Function("extract_from_date", extractFromDate), gval.Function("format_date", formatDate), gval.Function("get_value_current_day", getValueForCurrentDay), gval.Function("get_formatted_duration", getFormattedDuration), gval.Function("numberWithoutExponent", numberWithoutExponent), ) // LangEvalDateOpenDays is a custom GVal evaluator for business rules and facts conditions // It contains custom functions related to date (opendays support) LangEvalDateOpenDays = gval.NewLanguage( gval.Full(), gval.Function("calendar_add_od", addDurationOpenDays), gval.Function("calendar_delay_od", delayInOpenDays), ) // LangAdvancedInfix is a custom Gval evaluator for maps operations LangAdvancedInfix = gval.NewLanguage( gval.Full(), gval.InfixOperator("+", advancedAddition), gval.InfixOperator("-", advancedSubtraction), gval.InfixOperator("*", advancedMultiplication), gval.InfixOperator("/", advancedDivision), ) LangEvalMap = gval.NewLanguage( gval.Full(), gval.Function("flatten_fact", flattenFact), ) // LangEvalString is a custom GVal evaluator for handling char arrays (strings) LangEvalString = gval.NewLanguage( gval.Full(), gval.Function("replace", replace), ) LangEvalSlice = gval.NewLanguage( gval.Full(), gval.Function("contains", contains), gval.Function("append", appendSlice), ) LangEvalUrl = gval.NewLanguage( gval.Full(), gval.Function("url_encode", urlEncode), gval.Function("url_decode", urlDecode), ) )
Functions ¶
func AssertEqual ¶
AssertEqual checks if values are equal
func AssertNotEqual ¶
AssertNotEqual checks if values are not equal
func GetDateKeywords ¶
GetDateKeywords return a list of standard date time placeholders
func GetValidDayNames ¶
func GetValidDayNames() []string
func IsInvalidNumber ¶
func IsInvalidNumber(input interface{}) bool
IsInvalidNumber return true if the input interface is a not valid number
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.