0

I'm using zod, knex.js, Tedious, and js-joda with MS SQL Server. I want to pull a few columns as the appropriate js-joda type. For example, start_date is a date and I want it to be deserialized as a LocalDateTime (and vice versa). I'm just not sure how to get either knex.js or tedious to customize the data type returned, it's always a JS Date, which is inappropriate.

I have the code fairly encapsulated, so currently my best bet feels like just writing my getAll or getOne function with a pipe through my zod type's parse method...but it feels like knex or tedious should have a way to customize a given column's deserializer.

Chris Pfohl
  • 18,220
  • 9
  • 68
  • 111
  • Half of the answer is the ingoing parameter bindings that I missed the first time through the docs: https://knexjs.org/guide/#configuration-options But this is only the serialization step, not the deserialization step. – Chris Pfohl Jul 28 '23 at 18:21

0 Answers0