supabase-cache-helpers icon indicating copy to clipboard operation
supabase-cache-helpers copied to clipboard

Transformer API

Open psteinroe opened this issue 1 year ago • 3 comments

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 avatar Jul 17 '23 13:07 psteinroe

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[bot] avatar Aug 17 '23 01:08 github-actions[bot]

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[bot] avatar Sep 17 '23 02:09 github-actions[bot]

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

baba43 avatar Oct 26 '23 10:10 baba43