Use Postgres.js internal transform options
Eprince-hub opened this issue · comments
Postgres.js provides a way to normalize database data from snake_case
to camelCase
, and also convert any undefined
values to null
docs here: https://github.com/porsager/postgres#data-transformation
- We should delete
camelcase-keys
and use Postgres.js internal camelcase options - Use
undefined: null
to set all incomingundefined
values tonull
instead (which is a big source of confusion for students, see porsager/postgres#380 )
Code example
globalThis.postgresSqlClient = postgres({
transform: {
...postgres.toCamel,
undefined: null,
},
});
Sounds like a good idea! Let's do it for the next example.