Global Functions
Functions that can be used with different data types.
len(variable)
- if variable is primitive string, returns the length of the input string
- if variable is primitive list, returns the length of the list
- if variable is primitive map, returns the number of key-value pairs in the map
- if variable is json array, returns the number of elements in the array
- if variable is json object, returns the number of key-value pairs in the object
- if variable is Tuple, returns the number of elements in the tuple
- if variable is Map, returns the number of key-value pairs in the map
- if variable is Table, returns row count of the table
- if variable is MetricStream, returns the number of data series in the metric
- if variable is Alert, returns the number of entries in the alert
- else return 0
len("Hello") // return an int64 value of 5
len([1, 2, 3]) // return an int64 value of 3
len({Name: "foo", Domain: "@gmail.com"}) // return an int64 value of 2
append(list, element)
- if list is primitive string and element is primitive string, return a new string.
- if list is primitive list type and element is primitive value, appends element to the primitive value list
- if list is primitive json type and element is primitive value, appends element to the json array
- if list is tuple type, append element to the tuple
- else return error
let s = "ab"
s = append(s, "cd") // s is now the string "abcd"
let src = [1, 2, 3, 4]
append(src, 5) // src is still [1, 2, 3, 4] as it's value is not set to after append
src = append(src,5) // src is now [1, 2, 3, 4, 5]
typeof(variable)
- if variable is primitive value, returns the type of the primitive value: "string", "int64", "float64", "bool", "null", "undefined", "list", "map", "jsonObj", "jsonArray"
- else return the type of the object: "Tuple", "Map", "Lambda", "Table", "MetricStream", "Alert"
typeof(2) // return the string "int64"
typeof([1, 2, 3]) // return the string "list"
Updated 6 months ago