Skip to main content

FieldNaming

FieldNaming controls how result field names are renamed — used as QueryExecuteOptions.namingStrategy and ClientDefaults.fieldNaming. See Executing Queries for usage.

note

FieldNaming is a TypeScript union type, not a enum/const enum.

type FieldNaming =
| 'original'
| 'lowercase'
| 'uppercase'
| 'camelcase'
| 'pascalcase'
| ((fieldName: string) => Maybe<string>);
ValueEffect
'original'Field names are left untouched (this is also the effective behavior when no naming strategy is set at all).
'lowercase'Field names are lowercased.
'uppercase'Field names are uppercased.
'camelcase'Field names are converted to camelCase.
'pascalcase'Field names are converted to PascalCase.
(fieldName: string) => string | undefinedA custom function called once per field. Returning undefined drops that field from object rows entirely.
const result = await client.execute('select customer_id, first_name from customers', {
namingStrategy: 'camelcase',
});
// result.rows[0] -> { customerId: ..., firstName: ... }