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

Transformer API #245

Open
psteinroe opened this issue Jul 17, 2023 · 3 comments
Open

Transformer API #245

psteinroe opened this issue Jul 17, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@psteinroe
Copy link
Owner

Is your feature request related to a problem? Please describe.
In some cases, you might want to transform the data from PostgREST after fetching it, e.g. create a js Date for timestamptz columns, or convert the snake case to camel case (#244)

Describe the solution you'd like
Add a transformer API to all query hooks, that accepts a transformer: (result: R) => TransformedResult method. The transformer is applied within the fetcher, and before the data is written to the cache. It also transforms the Result type to ensure type-safety.

Describe alternatives you've considered
Wrapping the hooks and transform them afterwards.

@psteinroe psteinroe added the enhancement New feature or request label Jul 17, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Aug 17, 2023
@psteinroe psteinroe removed the stale label Aug 17, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Sep 17, 2023
@psteinroe psteinroe removed the stale label Sep 17, 2023
@baba43
Copy link

baba43 commented Oct 26, 2023

This is one of the first features that I was looking for. Simple use case: parse Dates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants