-
-
Notifications
You must be signed in to change notification settings - Fork 160
feat(types): setup postgrest-13 types inference #618
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
base: master
Are you sure you want to change the base?
feat(types): setup postgrest-13 types inference #618
Conversation
src/select-query-parser/result.ts
Outdated
? ClientOptions['postgrestVersion'] extends 13 // Spread over an many-to-many relationship, turn all the result fields into arrays | ||
? ProcessManyToManySpreadNodeResult<Result> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note
Here is what the conditionality for the inference can look like.
rest13: | ||
image: postgrest/postgrest:v13.0.0 | ||
ports: | ||
- '3001:3000' | ||
environment: | ||
PGRST_DB_URI: postgres://postgres:postgres@db:5432/postgres | ||
PGRST_DB_SCHEMAS: public,personal | ||
PGRST_DB_EXTRA_SEARCH_PATH: extensions | ||
PGRST_DB_ANON_ROLE: postgres | ||
PGRST_DB_PLAN_ENABLED: 1 | ||
PGRST_DB_TX_END: commit-allow-override | ||
PGRST_DB_AGGREGATES_ENABLED: true | ||
depends_on: | ||
- db | ||
rest12: | ||
image: postgrest/postgrest:v12.2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note
It is also possible to check if all the current tests and the new version ones are matching by upgrading the rest12
container to postgrest:v13
. I did so for testing, and except from the Spread on Many
feature, everything was behaving the same, with the only difference being the returned error message within some of the inline snapshots.
Co-authored-by: Steve Chavez <[email protected]>
What kind of change does this PR introduce?
This lay out the ground basis to start introducing new postgrest-13 features to the client library.
new PostgrestClient(DB_URL, { postgrestVersion: 12 | 13 }>
allowing the types inference to pick in and choose the right result based on the available features for this major version.