Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- elixir: "1.18.1"
otp: "27.2"
- elixir: "1.17.3"
otp: "27.1"
otp: "27.2"
- elixir: "1.17.3"
otp: "25.0.4"
- elixir: "1.14.5"
Expand Down
12 changes: 12 additions & 0 deletions lib/ecto/query/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,18 @@ defmodule Ecto.Query.API do
from p in Post, select: concat_ws(":", [p.author, ^year, p.title])
from s in Sequences, select: concat_ws(".", ["public", s.relname])

Or you may want to create re-usable macros for [Postgres's row constructor
comparison syntax](https://www.postgresql.org/docs/current/functions-comparisons.html#ROW-WISE-COMPARISON)
to support multi-column cursor-based pagination:

defmacro row_gt(columns, values) do
quote do
fragment("(?) >= (?)", splice(unquote(columns)), splice(unquote(values)))
end
end

from(p in Post, where: row_gt([p.visits, p.id], [^lower_visits, ^lower_id]))

You may nest others splices and fragment modifiers such as `identifier/1` and
`constant/1` inside of compile-time splices

Expand Down
Loading