Skip to content

Commit

Permalink
docs: document why we are using the union approach
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed May 14, 2024
1 parent b0fbee6 commit a73d48a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/slonik-dataloaders/src/utilities/batchQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { type z, type ZodTypeAny } from 'zod';
* Uses UNION to batch multiple queries that have the same shape.
* In contrast to using the `json_agg(row_to_json(t))` approach,
* this has the benefit of using native type parsing and
* avoid the overhead of serializing and deserializing JSON.
* avoids the overhead of serializing and deserializing JSON.
* This approach also has the benefit that it is compatible with
* Slonik interceptors that validate the shape of the result set.
*/
export const batchQueries = async <T extends ZodTypeAny>(
pool: CommonQueryMethods,
Expand Down

0 comments on commit a73d48a

Please sign in to comment.