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

Refactor QL #201

Merged
merged 27 commits into from
Oct 7, 2024
Merged

Refactor QL #201

merged 27 commits into from
Oct 7, 2024

Conversation

daogrady
Copy link
Contributor

@daogrady daogrady commented Aug 14, 2024

Fixes #227
Fixes #146

Rework QL to streamline many signatures and reuse recurring parts.

Grouping of Functionality

Recurring methods have been moved into aptly named interfaces (And, Columns, OrderBy, ...). This allows for a cleaner grouping of related functionality. This makes it easier for us to streamline behaviour between various ways to express the same thing (SELECT.from(x, COLUMNS), SELECT.from(x).columns(COLUMNS), etc).

Interface Declaration Merging

Query flavours that should offer methods from the interfaces mentioned above can just pull them in via declaration merging:

// following code is slightly simplified!
interface SELECT implements And, Columns {}
class SELECT { }  // instances of SELECT now offer the methods from And and Columns even without explicitly declaring them

Stricter Types

Types have been strictened where possible. Especially .columns and its various manifestations now try to actually derive the columns from valid properties:

SELECT.from(Books).columns('author')  // author being auto completed

The same has been attempted for .where/ .having. Best we can offer there is a sporadic error when the parameters are total bogus.

@daogrady daogrady marked this pull request as ready for review September 2, 2024 11:33
@daogrady
Copy link
Contributor Author

daogrady commented Sep 2, 2024

@mariayord this PR is quite excessive as it is a fundamental rewrite. I guess it needs a lot of testing to make sure no overload that was allowed before got lost... we can surely have a look together if you'd like.

@daogrady daogrady enabled auto-merge (squash) October 7, 2024 09:22
@daogrady daogrady merged commit 4f90ed9 into main Oct 7, 2024
7 checks passed
@daogrady daogrady deleted the chore/refactor-ql branch October 7, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] fully-typed orderBy Type Definitions for SELECT commands - is there an improvement possible?
2 participants