Skip to content

Comments

feat(DB): Add ITypedQueryBuilder#58373

Merged
provokateurin merged 2 commits intomasterfrom
feat/db/typed-query-builder
Feb 24, 2026
Merged

feat(DB): Add ITypedQueryBuilder#58373
provokateurin merged 2 commits intomasterfrom
feat/db/typed-query-builder

Conversation

@provokateurin
Copy link
Member

While it's not possible to infer the column types in the query builder for static analysis, this at least makes the column names available, which will already provide a lot more safety than we currently have. This way it is still necessary to cast columns, but at least psalm will be able to warn about columns that weren't selected.

@provokateurin provokateurin added this to the Nextcloud 34 milestone Feb 17, 2026
@provokateurin provokateurin requested a review from a team as a code owner February 17, 2026 09:31
@provokateurin provokateurin added enhancement 3. to review Waiting for reviews feature: database Database related DB labels Feb 17, 2026
@provokateurin provokateurin requested review from Altahrim and icewind1991 and removed request for a team February 17, 2026 09:31
@provokateurin provokateurin added the pending documentation This pull request needs an associated documentation update label Feb 17, 2026
@provokateurin provokateurin force-pushed the feat/db/typed-query-builder branch from 6199c74 to 3240224 Compare February 17, 2026 09:33
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give more details on why this is not possible directly in IQueryBuilder, and why the split between selectColumn and selectAlias is needed?

@provokateurin
Copy link
Member Author

The problem is that select() and selectDistinct allow other values that are not column names. For the typing to properly work, the column name needs to always be its own variable. Those methods also allow passing functions or columns with a table alias. There is no way to figure these out with typing, so alternative methods have to be used.

@provokateurin provokateurin force-pushed the feat/db/typed-query-builder branch from 3240224 to c34f819 Compare February 23, 2026 12:53
Signed-off-by: provokateurin <kate@provokateurin.de>
Signed-off-by: provokateurin <kate@provokateurin.de>
@provokateurin provokateurin force-pushed the feat/db/typed-query-builder branch from c34f819 to 161c91e Compare February 23, 2026 13:06
@provokateurin provokateurin merged commit 52a1d63 into master Feb 24, 2026
189 of 193 checks passed
@provokateurin provokateurin deleted the feat/db/typed-query-builder branch February 24, 2026 13:02
@provokateurin
Copy link
Member Author

@provokateurin provokateurin removed the pending documentation This pull request needs an associated documentation update label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement feature: database Database related DB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants