Ecto.Query.WindowAPI.lag
You're seeing just the function
lag
, go back to Ecto.Query.WindowAPI module for more information.
Returns value evaluated at the row that is offset rows before the current row within the partition.
If there is no such row, instead return default (which must be of the
same type as value). Both offset and default are evaluated with respect
to the current row. If omitted, offset defaults to 1 and default to nil
.
from e in Events,
windows: [w: [partition_by: e.name, order_by: e.tick]],
select: {
e.tick,
e.action,
e.name,
lag(e.action) |> over(:w), # previous_action
lead(e.action) |> over(:w) # next_action
}
Note that this function must be invoked using window function syntax.