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

Added clearGroupBy() #921

Merged
merged 2 commits into from
Mar 24, 2024
Merged

Added clearGroupBy() #921

merged 2 commits into from
Mar 24, 2024

Conversation

dswbx
Copy link
Contributor

@dswbx dswbx commented Mar 24, 2024

Adds the option to remove group by clause from SelectQueryBuilder using clearGroupBy() (as discussed in https://discord.com/channels/890118421587578920/1073948476590792786/threads/1221117943081996429)

I've only added a single node test, should I add additional ones for other environments?


Unrelated to this PR in particular: I had some issues making tests for mssql work. After following #906 it worked. Maybe we should add this to the Contribution Guidelines? Additionally I've had issues with prettier modifying indentation and tsc complaining about Duplicate identifier 'Prepend' – I had to manually disable lib checks. I'm running on node v20.8.0 and npm 10.1.0

Copy link

vercel bot commented Mar 24, 2024

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 Mar 24, 2024 0:42am

@koskimas
Copy link
Member

koskimas commented Mar 24, 2024

Thank you!

Additionally I've had issues with prettier modifying indentation

What do you mean by this? That's one of the things it's supposed to do, isn't it?

tsc complaining about Duplicate identifier 'Prepend'

I haven't experienced this one. Can you paste the whole error?

Maybe we should add this to the Contribution Guidelines

Good idea!

@igalklebanov igalklebanov added enhancement New feature or request api Related to library's API labels Mar 24, 2024
@dswbx
Copy link
Contributor Author

dswbx commented Mar 24, 2024

@koskimas regarding the type issue I was referring to, it's a bit embarrassing. Found out that a few directories up, I ran pnpm install and so that's where it came from. After removing it, the type issues are gone – sorry!

Regarding prettier, yes it's supposed to format the code, but it changed indentation within select-query-builder.ts I haven't modified. Here is an example running the prettier command on a clean repo:

$ git reset --hard origin/master
$ npm ci

added 416 packages, and audited 417 packages in 3s

100 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
$ npm run prettier

> [email protected] prettier
> prettier --write 'src/**/*.ts' 'test/**/*.ts'

[...]

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   src/operation-node/output-node.ts
        modified:   src/operation-node/select-query-node.ts
        modified:   src/parser/select-parser.ts
        modified:   src/parser/value-parser.ts
        modified:   src/query-builder/delete-query-builder.ts
        modified:   src/query-builder/insert-query-builder.ts
        modified:   src/query-builder/select-query-builder.ts
        modified:   src/query-builder/update-query-builder.ts
        modified:   src/schema/column-definition-builder.ts
        modified:   src/util/type-utils.ts
        modified:   test/node/src/introspect.test.ts
        modified:   test/node/src/test-setup.ts
        modified:   test/typings/test-d/insert.test-d.ts

no changes added to commit (use "git add" and/or "git commit -a")

$ npm ls prettier
[email protected] /Users/dennis/Projects/tmp/repos/kysely
└── [email protected]
$ git diff src/query-builder/select-query-builder.ts
diff --git a/src/query-builder/select-query-builder.ts b/src/query-builder/select-query-builder.ts
index dcdbe5c7..901db04f 100644
--- a/src/query-builder/select-query-builder.ts
    b/src/query-builder/select-query-builder.ts
@@ -2477,12  2477,12 @@ export type SelectQueryBuilderWithInnerJoin<
     ? InnerJoinedBuilder<DB, TB, O, A, DB[T]>
     : never
   : TE extends keyof DB
-  ? SelectQueryBuilder<DB, TB | TE, O>
-  : TE extends AliasedExpression<infer QO, infer QA>
-  ? InnerJoinedBuilder<DB, TB, O, QA, QO>
-  : TE extends (qb: any) => AliasedExpression<infer QO, infer QA>
-  ? InnerJoinedBuilder<DB, TB, O, QA, QO>
-  : never
     ? SelectQueryBuilder<DB, TB | TE, O>
     : TE extends AliasedExpression<infer QO, infer QA>
       ? InnerJoinedBuilder<DB, TB, O, QA, QO>
       : TE extends (qb: any) => AliasedExpression<infer QO, infer QA>
         ? InnerJoinedBuilder<DB, TB, O, QA, QO>
         : never

[...]

Could be also an issue on my end, like with the typing issue.

@koskimas
Copy link
Member

Oh, yeah. We don't have anything that automatically runs prettier. This happens when we update prettier to a newer version and forget to run prettier for all files. You can either discard those changes or just add them to the PR.

@koskimas koskimas merged commit 0fd4de8 into kysely-org:master Mar 24, 2024
5 checks passed
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants