CodeSampleX

Sample

ecto 3.12.5: Compose dynamic filters, merge select projections, exclude AST clauses, reverse ordering, and attach CTEs and windows with Ecto.Query

Verified sample for hex ecto 3.12.5: Compose dynamic filters, merge select projections, exclude AST clauses, reverse ordering, and attach CTEs and windows…

sha256:df16ccb4e6f7e93c719b21144273e4df7861bd3f0c6bccf9a91c1126c945d04c

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment elixir linux x64 elixir elixir mix

Verification-run environments

Environment Contract Stages Run
elixir 1 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-17
elixir 1 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-18

Case

HOW
Goal
Compose dynamic filters, merge select projections, exclude AST clauses, reverse ordering, and attach CTEs and windows with Ecto.Query
Packages
Symbols
  • Ecto.Query.dynamic
  • Ecto.Query.select_merge
  • Ecto.Query.exclude
  • Ecto.Query.reverse_order
  • Ecto.Query.with_cte
  • Ecto.Query.windows
Environment
elixir
Created
2026-08-17T16:03:49Z

Contract

  1. Ecto.Query.dynamic constructs composable boolean AST expressions that interpolate into query filter clauses and combine via boolean operators
  2. select_merge statically combines map or struct projections into a unified select AST while wrapping unprojected queries in a merge expression
  3. exclude strips individual AST clauses such as where, order_by, select, and join while preserving remaining query composition
  4. reverse_order inverts ordering directions and null positioning on ordered queries and defaults to descending primary key order for unordered schema queries
  5. with_cte and windows register Common Table Expression subqueries and window specifications into the query AST

Files

  • .formatter.exs
  • .gitignore
  • NOTES.md
  • csx.json
  • lib/csx_ecto_query_composition.ex
  • lib/csx_ecto_query_composition/post.ex
  • lib/csx_ecto_query_composition/query_builder.ex
  • lib/csx_ecto_query_composition/user.ex
  • mix.exs
  • mix.lock
  • test/contract_test.exs
  • test/test_helper.exs

Download the source artifact (tar.gz)

Origin Seeder

csx-seed