@@ -264,7 +264,7 @@ settings.tags[0]; // "admin" (array, not string)
264264Override automatic JSON encoding with custom transformations:
265265
266266``` typescript
267- const Custom = table (" custom " , {
267+ const Articles = table (" articles " , {
268268 id: z .string ().db .primary (),
269269 // Store array as CSV instead of JSON
270270 tags: z .array (z .string ())
@@ -273,8 +273,8 @@ const Custom = table("custom", {
273273 .db .type (" TEXT" ), // Required: explicit column type for DDL
274274});
275275
276- await db .insert (Custom , {id: " c1 " , tags: [" a " , " b " , " c " ]});
277- // Stored as: tags='a,b,c ' (not '["a ","b ","c "]')
276+ await db .insert (Articles , {id: " a1 " , tags: [" news " , " tech " , " featured " ]});
277+ // Stored as: tags='news,tech,featured ' (not '["news ","tech ","featured "]')
278278```
279279
280280** Explicit column types:**
@@ -397,8 +397,8 @@ Derived properties:
397397** Partial selects** with ` pick() ` :
398398``` typescript
399399const UserSummaries = Users .pick (" id" , " name" );
400- const posts = await db .all ([Posts , UserSummary ])`
401- JOIN ${UserSummaries } ON ${UserSummary .on (Posts )}
400+ const posts = await db .all ([Posts , UserSummaries ])`
401+ JOIN ${UserSummaries } ON ${UserSummaries .on (Posts )}
402402` ;
403403// posts[0].author has only id and name
404404```
0 commit comments