diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e90caead3f..c9e689b1af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" diff --git a/lib/ecto/query/api.ex b/lib/ecto/query/api.ex index a9ffbcfbe2..beced752f9 100644 --- a/lib/ecto/query/api.ex +++ b/lib/ecto/query/api.ex @@ -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