Transforms Slonik query result field names into camelCase.
Motivation
This interceptor removes the necessity to alias field names, e.g.
connection.any(sql` SELECT id, full_name "fullName" FROM person`);
Field name transformation uses the transformRow interceptor method to format field names. Rows are copied by a function that is compiled once per set of fields, and rows whose field names do not need to be transformed are returned as they are.
You can configure which fields should be transformed by providing a test function to createFieldNameTransformationInterceptor
/** * @property test Tests whether the field should be formatted. * All fields that pass this test will have their names converted to camelCase. */type ConfigurationType = { test: (field: FieldType) => boolean;};(configuration: ConfigurationType) => InterceptorType;