exosql v0.2.88 ExoSQL.Builtins View Source
Builtin functions.
There are two categories, normal functions and aggregate functions. Aggregate functions receive as first parameter a ExoSQL.Result with a full table, and the rest of parameters are the function calling parameters, unsolved.
These expressions must be first simplified with
ExoSQL.Expr.simplify and then executed on the rows with
ExoSQL.Expr.run_expr.
Link to this section Summary
Functions
Returns the first not NULL
Print some value to the log
sprintf style formatting
Very simple sprintf formatter. Knows this formats
Generates a table with the series of numbers as given. Use for histograms without holes
Gets the domain from the domain name
Get the greatest of arguments
Performs a JSON Pointer search on JSON data
Convert from a string to a JSON object
Get the least of arguments
Returns NULL if both equal, first argument if not
Creates a range, which can later be used in
Performs a regex match
Performs a regex scan
Convert datetime to string
Extracts some keys from each value on an array and returns the array of those values
Parses an URL and return some part of it
Returns to which bucket it belongs
Link to this section Functions
abs(n) View Source
avg(data, expr) View Source
bool(arg1) View Source
call_function(name, params) View Source
cant_simplify(f) View Source
ceil_(n) View Source
coalesce(a, b) View Source
Returns the first not NULL
coalesce(a, b, c) View Source
coalesce(a, b, c, d) View Source
coalesce(a, b, c, d, e) View Source
count(data, expr) View Source
debug(str) View Source
Print some value to the log
floor_(n) View Source
format(str) View Source
sprintf style formatting.
Known interpolations:
%d - Integer %f - Float, 2 digits %.Nf - Float N digits %k - integer with k, M sufix %.k - float with k, M sufix, uses float part
format(str, args) View Source
Very simple sprintf formatter. Knows this formats:
- %%
- %s
- %d
- %f (only two decimals)
- %.{ndec}f
format(str, arg1, arg2) View Source
format(str, arg1, arg2, arg3) View Source
format(str, arg1, arg2, arg3, arg4) View Source
format(str, arg1, arg2, arg3, arg4, arg5) View Source
format(str, arg1, arg2, arg3, arg4, arg5, arg6) View Source
format(str, arg1, arg2, arg3, arg4, arg5, arg6, arg7) View Source
format(str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) View Source
format(str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) View Source
generate_series(end_) View Source
Generates a table with the series of numbers as given. Use for histograms without holes.
generate_series(start_, end_) View Source
generate_series(start_, end_, days) View Source
get_domain(hostname) View Source
Gets the domain from the domain name.
This means "google" from "www.google.com" or "google" from "www.google.co.uk"
The algorithm disposes the tld (.uk) and the skips unwanted names (.co). Returns the first thats rest, or a default that is originally the full domain name or then each disposed part.
greatest(a, b) View Source
Get the greatest of arguments
greatest(a, b, c) View Source
greatest(a, b, c, d) View Source
greatest(a, b, c, d, e) View Source
is_aggregate(x) View Source
is_lit(arg1) View Source
is_projectable(f) View Source
join(str) View Source
join(str, sep) View Source
jp(json, idx) View Source
Performs a JSON Pointer search on JSON data.
It just uses / to separate keys.
json(str) View Source
Convert from a string to a JSON object
least(a, b) View Source
Get the least of arguments.
Like min, for not for aggregations.
least(a, b, c) View Source
least(a, b, c, d) View Source
least(a, b, c, d, e) View Source
log(n) View Source
lower(s) View Source
max_(data, expr) View Source
min_(data, expr) View Source
mod(n, m) View Source
now(tz) View Source
nullif(a, a) View Source
Returns NULL if both equal, first argument if not.
power(x, n) View Source
randint(max_) View Source
randint(min_, max_) View Source
random() View Source
range(a, b) View Source
Creates a range, which can later be used in:
IN-- Subset / element contains*-- Interesection -> nil if no intersection, the intersected range if any.
regex(str, regexs) View Source
Performs a regex match
May return a list of groups, or a dict with named groups, depending on the regex.
As an optional third parameter it performs a jp query.
Returns NULL if no match (which is falsy, so can be used for expressions)
regex(str, regexs, query) View Source
regex_all(str, regexs) View Source
Performs a regex scan
Returns all the matches, if groups are used, then its a list of groups matching.
As an optional third parameter it performs a jp query.
Returns NULL if no match (which is falsy, so can be used for expressions)
regex_all(str, regexs, query) View Source
regex_all_real(str, regexs) View Source
regex_real(str, regexs) View Source
round(n) View Source
round(n, r) View Source
sign(n) View Source
simplify(name, params) View Source
split(str) View Source
split(str, sep) View Source
sqrt(n) View Source
strftime(d) View Source
Convert datetime to string.
If no format is given, it is as to_string, which returns the ISO 8601. Format allows all substitutions from Timex.format, for example:
%d day of month: 00 %H hour: 00-24 %m month: 01-12 %M minute: 00-59 %s seconds since 1970-01-01 %S seconds: 00-59 %Y year: 0000-9999 %i ISO 8601 format %V Week number %% %
strftime(d, format) View Source
substr(str, skip) View Source
substr(str, skip, len) View Source
sum(data, expr) View Source
to_datetime(other) View Source
to_datetime(other, mod) View Source
to_string_(d) View Source
to_timestamp(d) View Source
trim(str) View Source
unnest(array) View Source
Extracts some keys from each value on an array and returns the array of those values
unnest(array, cols) View Source
unnest(array, col1, col2) View Source
unnest(array, col1, col2, col3) View Source
unnest(array, col1, col2, col3, col4) View Source
unnest(array, col1, col2, col3, col4, col5) View Source
unnest(array, col1, col2, col3, col4, col5, col5) View Source
unnest(array, col1, col2, col3, col4, col5, col5, col6) View Source
unnest(array, col1, col2, col3, col4, col5, col5, col6, col7) View Source
unnest(array, col1, col2, col3, col4, col5, col5, col6, col7, col8) View Source
upper(s) View Source
urlparse(url) View Source
Parses an URL and return some part of it.
If not what is provided, returns a JSON object with:
- host
- port
- scheme
- path
- query
- user
If what is passed, it performs a JSON Pointer search (jp function).
It must receive a url with scheme://server or the result may not be well formed.
For example, for emails, just use "email://connect@serverboards.io" or similar.
urlparse(url, what) View Source
width_bucket(n, start_, end_, nbuckets) View Source
Returns to which bucket it belongs.
Only numbers, but datetimes can be transformed to unix datetime.