Documentation
¶
Index ¶
- func AllFunc(ctx expr.EvalContext, vals ...value.Value) (value.BoolValue, bool)
- func AnyFunc(ctx expr.EvalContext, vals ...value.Value) (value.BoolValue, bool)
- func ContainsFunc(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool)
- func CountFunc(ctx expr.EvalContext, val value.Value) (value.IntValue, bool)
- func DayOfWeek(ctx expr.EvalContext, items ...value.Value) (value.IntValue, bool)
- func EmailDomainFunc(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
- func EmailFunc(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
- func EmailNameFunc(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
- func Eq(ctx expr.EvalContext, itemA, itemB value.Value) (value.BoolValue, bool)
- func Exists(ctx expr.EvalContext, item interface{}) (value.BoolValue, bool)
- func Ge(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool)
- func Gt(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool)
- func HostFunc(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
- func HourOfDay(ctx expr.EvalContext, items ...value.Value) (value.IntValue, bool)
- func HourOfWeek(ctx expr.EvalContext, items ...value.Value) (value.IntValue, bool)
- func JoinFunc(ctx expr.EvalContext, items ...value.Value) (value.StringValue, bool)
- func LeFunc(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool)
- func LoadAllBuiltins()
- func Lower(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
- func LtFunc(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool)
- func MapFunc(ctx expr.EvalContext, lv, rv value.Value) (value.MapValue, bool)
- func Match(ctx expr.EvalContext, items ...value.Value) (value.MapValue, bool)
- func Mm(ctx expr.EvalContext, items ...value.Value) (value.IntValue, bool)
- func Ne(ctx expr.EvalContext, itemA, itemB value.Value) (value.BoolValue, bool)
- func NotFunc(ctx expr.EvalContext, item value.Value) (value.BoolValue, bool)
- func Now(ctx expr.EvalContext, items ...value.Value) (value.TimeValue, bool)
- func OneOfFunc(ctx expr.EvalContext, vals ...value.Value) (value.Value, bool)
- func PowFunc(ctx expr.EvalContext, val, toPower value.Value) (value.NumberValue, bool)
- func Qs(ctx expr.EvalContext, urlItem, keyItem value.Value) (value.StringValue, bool)
- func Replace(ctx expr.EvalContext, vals ...value.Value) (value.StringValue, bool)
- func SplitFunc(ctx expr.EvalContext, input value.Value, splitByV value.StringValue) (value.StringsValue, bool)
- func SqrtFunc(ctx expr.EvalContext, val value.Value) (value.NumberValue, bool)
- func TimeExtractFunc(ctx expr.EvalContext, items ...value.Value) (value.StringValue, bool)
- func TimeSeconds(ctx expr.EvalContext, val value.Value) (value.NumberValue, bool)
- func ToDate(ctx expr.EvalContext, items ...value.Value) (value.TimeValue, bool)
- func ToInt(ctx expr.EvalContext, item value.Value) (value.IntValue, bool)
- func ToNumber(ctx expr.EvalContext, item value.Value) (value.NumberValue, bool)
- func ToTimestamp(ctx expr.EvalContext, item value.Value) (value.IntValue, bool)
- func UrlDecode(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
- func UrlMain(ctx expr.EvalContext, urlItem value.Value) (value.StringValue, bool)
- func UrlMinusQs(ctx expr.EvalContext, urlItem, keyItem value.Value) (value.StringValue, bool)
- func UrlPath(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
- func UuidGenerate(ctx expr.EvalContext) (value.StringValue, bool)
- func Yy(ctx expr.EvalContext, items ...value.Value) (value.IntValue, bool)
- func YyMm(ctx expr.EvalContext, items ...value.Value) (value.StringValue, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllFunc ¶
All: Answers True/False if all of the arguments evaluate to truish (javascripty)
type definintion of true int > 0 = true string != "" = true boolean natively supported true/false all("hello",2, true) => true all("hello",0,true) => false all("",2, true) => false
func AnyFunc ¶
Any: Answers True/False if any of the arguments evaluate to truish (javascripty)
type definintion of true int > 0 = true string != "" = true any(item,item2) => true, true any(not_field) => false, true
func CountFunc ¶
Count: count occurences of value, ignores the value and ensures it is non null
count(anyvalue) => 1, true count(not_number) => -- Could not be evaluated
func EmailDomainFunc ¶
func EmailDomainFunc(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
email a string, parses email
email("Bob <bob@bob.com>") => bob@bob.com
func EmailFunc ¶
func EmailFunc(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
email a string, parses email
email("Bob <bob@bob.com>") => bob@bob.com, true email("Bob <bob>") => "", false
func EmailNameFunc ¶
func EmailNameFunc(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
emailname a string, parses email
emailname("Bob <bob@bob.com>") => Bob
func Exists ¶
func Exists(ctx expr.EvalContext, item interface{}) (value.BoolValue, bool)
Exists: Answers True/False if the field exists and is non null
exists(real_field) => true exists("value") => true exists("") => false exists(empty_field) => false exists(2) => true exists(todate(date_field)) => true
func HostFunc ¶
func HostFunc(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
Extract host from a String (must be urlish), doesn't do much/any validation
host("http://www.lytics.io/index.html") => http://www.lytics.io
In the event the value contains more than one input url, will ONLY evaluate first
func HourOfWeek ¶
hour of week [0-167]
func JoinFunc ¶
func JoinFunc(ctx expr.EvalContext, items ...value.Value) (value.StringValue, bool)
Join items together (string concatenation)
join("apples","oranges",",") => "apples,oranges" join(["apples","oranges"],",") => "apples,oranges" join("apples","oranges","") => "applesoranges"
func LoadAllBuiltins ¶
func LoadAllBuiltins()
func Lower ¶
func Lower(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
String lower function
must be able to convert to string
func MapFunc ¶
Map() Create a map from two values. If the right side value is nil
then does not evaluate Map(left, right) => map[string]value{left:right}
func Match ¶
match: Match a simple pattern match and return matched value
given input: {"score_value":24,"event_click":true} match("score_") => {"value":24} match("amount_") => false match("event_") => {"click":true}
func Mm ¶
Get month as integer from date
@optional timestamp (if not, gets from context reader) mm() => 01, true /// assuming message ts = jan 1 mm("2014-03-17") => 03, true
func Now ¶
Get current time of Message (message time stamp) or else choose current
server time if none is available in message context
func PowFunc ¶
func PowFunc(ctx expr.EvalContext, val, toPower value.Value) (value.NumberValue, bool)
Pow: exponents, raise x to the power of y
pow(5,2) => 25, true pow(3,2) => 9, true pow(not_number,2) => 0, false
func Qs ¶
func Qs(ctx expr.EvalContext, urlItem, keyItem value.Value) (value.StringValue, bool)
Extract qs param from a string (must be url valid)
qs("http://www.lytics.io/?utm_source=google","utm_source") => "google", true
func Replace ¶
func Replace(ctx expr.EvalContext, vals ...value.Value) (value.StringValue, bool)
Replace a string(s), accepts any number of parameters to replace
replaces with "" replace("/blog/index.html", "/blog","M2") => /index.html replace(item, "M")
func SplitFunc ¶
func SplitFunc(ctx expr.EvalContext, input value.Value, splitByV value.StringValue) (value.StringsValue, bool)
Split a string, accepts an optional with parameter
split(item, ",")
func SqrtFunc ¶
func SqrtFunc(ctx expr.EvalContext, val value.Value) (value.NumberValue, bool)
Sqrt
sqrt(4) => 2, true sqrt(9) => 3, true sqrt(not_number) => 0, false
func TimeExtractFunc ¶
func TimeExtractFunc(ctx expr.EvalContext, items ...value.Value) (value.StringValue, bool)
func TimeSeconds ¶
func TimeSeconds(ctx expr.EvalContext, val value.Value) (value.NumberValue, bool)
func ToDate ¶
todate: convert to Date
todate(field) uses araddon\dateparse util to recognize formats todate("01/02/2006", field ) uses golang date parse rules first parameter is the layout/format
func ToInt ¶
Convert to Integer: Best attempt at converting to integer
toint("5") => 5 toint("5.75") => 5 toint("5,555") => 5555 toint("$5") => 5 toint("5,555.00") => 5555
func ToNumber ¶
func ToNumber(ctx expr.EvalContext, item value.Value) (value.NumberValue, bool)
Convert to Number: Best attempt at converting to integer
tonumber("5") => 5.0 tonumber("5.75") => 5.75 tonumber("5,555") => 5555 tonumber("$5") => 5.00 tonumber("5,555.00") => 5555
func ToTimestamp ¶
totimestamp: convert to date, then to unix Seconds
func UrlDecode ¶
func UrlDecode(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
url decode a string
urldecode("http://www.lytics.io/index.html") => http://www.lytics.io
In the event the value contains more than one input url, will ONLY evaluate first
func UrlMain ¶
func UrlMain(ctx expr.EvalContext, urlItem value.Value) (value.StringValue, bool)
urlmain remove the querystring and scheme from url
urlmain("http://www.lytics.io/?utm_source=google") => "www.lytics.io/", true
func UrlMinusQs ¶
func UrlMinusQs(ctx expr.EvalContext, urlItem, keyItem value.Value) (value.StringValue, bool)
urlminusqs removes a specific query parameter and its value from a url
urlminusqs("http://www.lytics.io/?q1=google&q2=123", "q1") => "http://www.lytics.io/?q2=123", true
func UrlPath ¶
func UrlPath(ctx expr.EvalContext, item value.Value) (value.StringValue, bool)
Extract url path from a String (must be urlish), doesn't do much/any validation
path("http://www.lytics.io/blog/index.html") => blog/index.html
In the event the value contains more than one input url, will ONLY evaluate first
func UuidGenerate ¶
func UuidGenerate(ctx expr.EvalContext) (value.StringValue, bool)
uuid generates a uuid
func Yy ¶
Get year in integer from field, must be able to convert to date
yy() => 15, true // assuming it is 2015 yy("2014-03-01") => 14, true
func YyMm ¶
func YyMm(ctx expr.EvalContext, items ...value.Value) (value.StringValue, bool)
Get yymm in 4 digits from argument if supplied, else uses message context ts
Types ¶
This section is empty.