Insert returning api to match select columns

I have the following helpers to select the right columns and ensure I don't leak sensitive data:

export const userSelectPublicColumns = { id: true, firstName: true, lastName: true }
export const userSelectSensitiveColumns = {
  ...userSelectPublicColumns,
  email: true,
  mobileNumber: true,


However when I come to call insert().returning() it seems the .returning() method takes a different shape and I'll need to duplicate my objects values above from boolean
true
to table.columnKey

Anyway around this duplication?
image.png
Was this page helpful?