File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
grafast/website/grafast/step-library/dataplan-pg/registry Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,30 @@ const forumCodec = recordCodec({
138
138
139
139
- ` identifier ` - the database name for this type
140
140
141
+ ### Example
142
+
143
+ For example, in this hypothetical E-commerce scenario, ` listOfCodec ` is used
144
+ in combination with the ` $pgSelect.placeholder() ` method to return a SQL
145
+ expression that allows the transformed list of ` $orderIds ` to be referenced
146
+ inside the step for selecting the associated order items.
147
+
148
+ ``` ts
149
+ const $orders = orders .find ({
150
+ customer_id: context ().get (" customerId" ),
151
+ });
152
+
153
+ const $orderIds = applyTransforms (each ($orders , ($order ) => $order .get (" id" )));
154
+
155
+ const $orderItems = registry .pgResources .order_items .find ();
156
+
157
+ $orderItems .where (
158
+ sql ` ${$orderItems }.order_id = ANY (${$orderItems .placeholder (
159
+ $orderIds ,
160
+ listOfCodec (TYPES .uuid ),
161
+ )}) ` ,
162
+ );
163
+ ```
164
+
141
165
## rangeOfCodec(innerCodec, name, identifier)
142
166
143
167
` rangeOfCodec ` returns a new codec that represents a range of the given
You can’t perform that action at this time.
0 commit comments