Skip to content

Commit ba4181f

Browse files
the-red-herringporsager
authored andcommitted
add compatible cases for default transforms
Explain that snake_case is the only case for column names that is compatible with the default transform functions.
1 parent 779d69b commit ba4181f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,8 @@ Built in transformation functions are:
604604
* For PascalCase - `postgres.pascal`, `postgres.toPascal`, `postgres.fromPascal`
605605
* For Kebab-Case - `postgres.kebab`, `postgres.toKebab`, `postgres.fromKebab`
606606

607+
These built in transformations will only convert to/from snake_case. For example, using `{ transform: postgres.toCamel }` will convert the column names to camelCase only if the column names are in snake_case to begin with. `{ transform: postgres.fromCamel }` will convert camelCase only to snake_case.
608+
607609
By default, using `postgres.camel`, `postgres.pascal` and `postgres.kebab` will perform a two-way transformation - both the data passed to the query and the data returned by the query will be transformed:
608610

609611
```js

0 commit comments

Comments
 (0)