Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revisiting orderBy. #1326

Merged
merged 32 commits into from
Jan 25, 2025
Merged

Conversation

igalklebanov
Copy link
Member

@igalklebanov igalklebanov commented Jan 19, 2025

Hey 👋

fixes #1300
closes #1209
closes #714

This PR revisits and shows some love to orderBy.

  1. orderBy is everywhere now (select, delete, over, function arguments, etc.), so it only makes sense to extract it to its own OrderByInterface and its node methods to QueryNode to ease maintenance and dry up things.
  2. orderBy has been added to UpdateQueryBuilder - supported only in MySQL.
  3. the changes made 18 months ago to support "single call multiple items" are getting deprecated. This includes the following variants: orderBy('column asc') and orderBy([...]) - which are up to ~3x worse in compile-time performance than alternatives, and an inelegant limiting solution now that orderBy is not just about asc|desc.
  4. orderBy(..., (ob) => ob.collate('nocase').asc().nullFirst()) is added. Supporting nulls {first|last} (PostgreSQL/SQLite) - one of the most requested features according to GitHub reactions, collate <collation>, and asc|desc.

Copy link

vercel bot commented Jan 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kysely ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 25, 2025 9:32pm

@igalklebanov igalklebanov changed the title TBD revisiting orderBy - deperecate (ref direction), (expr, expr), introduce OrderByItemBuilder. Jan 20, 2025
@igalklebanov igalklebanov changed the title revisiting orderBy - deperecate (ref direction), (expr, expr), introduce OrderByItemBuilder. revisiting orderBy - deperecate (ref direction), (expr, expr), (array), introduce OrderByItemBuilder. Jan 20, 2025
@igalklebanov igalklebanov changed the title revisiting orderBy - deperecate (ref direction), (expr, expr), (array), introduce OrderByItemBuilder. revisiting orderBy - deperecate (ref direction), (expr, expr), (array), introduce OrderByItemBuilder, OrderByInterface. Jan 20, 2025
@igalklebanov igalklebanov added enhancement New feature or request api Related to library's API breaking change Includes breaking changes deprecation Something is/should be deprecated mysql Related to MySQL sqlite Related to sqlite postgres Related to PostgreSQL and removed breaking change Includes breaking changes labels Jan 20, 2025
@igalklebanov igalklebanov merged commit 5af5f80 into kysely-org:v0.28 Jan 25, 2025
27 checks passed
@igalklebanov igalklebanov deleted the order-by-stuff branch January 25, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Related to library's API deprecation Something is/should be deprecated enhancement New feature or request mssql Related to MS SQL Server (MSSQL) mysql Related to MySQL postgres Related to PostgreSQL sqlite Related to sqlite
Projects
None yet
1 participant