Ash FrameworkAF
Ash Frameworkโ€ข3y ago
axdc

Adding Postgres NULLS LAST to an Ash prepare build sort

Hi! I spent a little bit trying to figure this out and wanted to share to make it more searchable.

Ash's sorts actually support NULLS FIRST and NULLS LAST as different options passed instead of the normal :asc, :desc, etc:

prepare build(sort: [published_at: :desc_nils_last, inserted_at: :desc])


The documentation references nils, rather than Postgres NULLS, so it didn't come up.

https://ash-hq.org/docs/module/ash/latest/ash-sort#type-sort_order-0

Thanks!
Ash HQ
View the documentation for Ash.Sort on Ash HQ.
Module: Ash.Sort
Was this page helpful?