QuackDB.Ecto.WindowFrames (quackdb v0.4.0)

Copy Markdown View Source

DuckDB window-frame helpers for Ecto queries.

Ecto versions before the release containing ecto#4730 only accept literal fragment(...) calls in a window :frame option. These helpers are ready for that Ecto release; until your project depends on it, use the generated SQL shape directly:

frame: fragment("ROWS BETWEEN 6 PRECEDING AND CURRENT ROW")

Once macro-expanded frames are available in your Ecto version, helpers can be used as:

frame: rows_between({:preceding, 6}, :current_row)
frame: range_between(:unbounded_preceding, {:following, 1})

Summary

Functions

Builds a GROUPS BETWEEN ... AND ... window frame fragment.

Builds a RANGE BETWEEN ... AND ... window frame fragment.

Builds a ROWS BETWEEN ... AND ... window frame fragment.

Functions

groups_between(start_bound, end_bound)

(macro)

Builds a GROUPS BETWEEN ... AND ... window frame fragment.

range_between(start_bound, end_bound)

(macro)

Builds a RANGE BETWEEN ... AND ... window frame fragment.

rows_between(start_bound, end_bound)

(macro)

Builds a ROWS BETWEEN ... AND ... window frame fragment.