We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Note that I'm going to talk about the distinctOn method but there are others methods in the same situation.
We are using distinctOn which is only supported for Postgres.
I get the error:
'.distinctOn() is currently only supported on PostgreSQL'
This is because the mock client extends the basic knex client. This client uses the basic query compiler, that has the implementation:
// node_modules/knex/lib/query/querycompiler.js distinctOn(value) { throw new Error('.distinctOn() is currently only supported on PostgreSQL'); }
Work around I found for this problem:
class MockClientWithDistinctOn extends MockClient { queryCompiler(builder: any) { const queryCompiler = super.queryCompiler(builder); queryCompiler.distinctOn = (value: any) => ''; return queryCompiler; } } ... const database = knex({ client: MockClientWithDistinctOn }
Maybe we could have a MockClient for each supported client. If this is to much we could just return an empty string for these methods.
The text was updated successfully, but these errors were encountered:
I need to check for possible solutions... I don't want to stub each one of the specific functions.
Sorry, something went wrong.
Added in v1.6.0, thank you for reporting this issue, now the lib supports a specific dialects :]
v1.6.0
Successfully merging a pull request may close this issue.
Note that I'm going to talk about the distinctOn method but there are others methods in the same situation.
We are using distinctOn which is only supported for Postgres.
I get the error:
This is because the mock client extends the basic knex client. This client uses the basic query compiler, that has the implementation:
Work around I found for this problem:
Maybe we could have a MockClient for each supported client. If this is to much we could just return an empty string for these methods.
The text was updated successfully, but these errors were encountered: