Open karlhorky opened 1 month ago
Is your feature request related to a problem? Please describe.
The option connections.targets.fieldTransform: 'camel' is not applying to JSON fields like it does with Postgres.js
connections.targets.fieldTransform: 'camel'
Code below assumes config of connections.targets.fieldTransform: 'camel'
// 💥 Query has incorrect type annotation. // Expected: { contact: { userId: number } }[] // Actual: { contact: { user_id: number } }[] await sql<{ contact: { userId: number } }[]>` SELECT jsonb_build_object('user_id', users.id) AS contact FROM users `;
Describe the solution you'd like
Apply connections.targets.fieldTransform to nested JSON / JSONB fields, either as:
connections.targets.fieldTransform
Describe alternatives you've considered
Provide a different option (eg. jsonFieldTransform) to allow for additional customization.
jsonFieldTransform
Additional context
--
Manually specify camel case field names in the JSON / JSONB:
// ✅ await sql<{ contact: { userId: number } }[]>` SELECT jsonb_build_object('userId', users.id) AS contact FROM users `;
Is your feature request related to a problem? Please describe.
The option
connections.targets.fieldTransform: 'camel'
is not applying to JSON fields like it does with Postgres.jsCode below assumes config of
connections.targets.fieldTransform: 'camel'
Describe the solution you'd like
Apply
connections.targets.fieldTransform
to nested JSON / JSONB fields, either as:Describe alternatives you've considered
Provide a different option (eg.
jsonFieldTransform
) to allow for additional customization.Additional context
--