ex_orient v1.2.0 ExOrient.Functions
DSL for http://orientdb.com/docs/last/SQL-Functions.html
An attempt to move as much of the query language out of strings as possible.
Usage examples:
> import ExOrient.DB
> import ExOrient.Functions
> select(out("works_for") |> expand(), from: Person) |> exec()
> select(out("owns") |> expand(), from: Person) |> exec()
> select(count("*"), from: Person) |> exec()
Important note: Some function names collide with Elixir syntax. These functions have
o_
prepended onto their names. For example,o_in
instead ofin
.
Summary
Functions
http://orientdb.com/docs/last/SQL-Functions.html#avg
> DB.select(avg(:salary), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#both
> DB.select(both(Following), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#bothe
> DB.select(both_e(), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#coalesce
> DB.select(coalesce(:amount), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#count
> DB.select(count("*"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#date
> DB.select(date("03-08-2016", "MM-dd-yyyy", "UTC"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#difference
> DB.select(difference(:friends), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#dijkstra
> DB.select(dijkstra("#11:0", "#11:27"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#distance
> DB.select(distance(:x, :y, 52.02342, 13.32142), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#distinct
> DB.select(distinct(:surname), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#eval
> DB.select(eval("1 + 2"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#expand
> DB.select(expand(out(Following)), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#first
> DB.select(first(:addresses), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#format
> DB.select(format("Mr. %s", [:surname]), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#ine
> DB.select(in_e(), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#inv
> DB.select(in_v(), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#intersect
> DB.select(intersect(:friends), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#last
> DB.select(last(:addresses), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#list
> DB.select(list("roles.name"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#map
> DB.select(map("name", "roles.name"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#median
> DB.select(mode(:median), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#mode
> DB.select(mode(:salary), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#abs
> DB.select(o_abs(:net_worth), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#if
> DB.select(o_if("true", "Do if true", "Do if false"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#in
> DB.select(o_in(Following), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#max
> DB.select(o_max(:salary), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#min
> DB.select(o_min(:salary), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#out
> DB.select(out(Following), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#oute
> DB.select(out_e(), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#outv
> DB.select(out_v(), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#percentile
> DB.select(percentile(:salary, 95), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#set
> DB.select(set("roles.name"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#shortestpath
> DB.select(shortest_path("#11:0", "#11:27"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#stddev
> DB.select(stddev(:salary), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#sum
> DB.select(sum(:salary), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#symmetricdifference
> DB.select(symmetric_difference(:friends), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#sysdate
> DB.select(sysdate("MM-dd-yyyy", "UTC"), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#traversededge
> DB.select(traversed_edge(-1), from: "TRAVERSE out() FROM #12:12")
http://orientdb.com/docs/last/SQL-Functions.html#traversedelement
> DB.select(traversed_element(-1), from: "TRAVERSE out() FROM #12:12")
http://orientdb.com/docs/last/SQL-Functions.html#traversedvertex
> DB.select(traversed_vertex(-1), from: "TRAVERSE out() FROM #12:12")
http://orientdb.com/docs/last/SQL-Functions.html#unionall
> DB.select(unionall(:friends), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#uuid
> DB.select(uuid(), from: Person)
http://orientdb.com/docs/last/SQL-Functions.html#variance
> DB.select(variance(:salary), from: Person)