any way to automatically cast numeric types on retrieval?
I have a numeric field in a video table:
but
duration
is a string so I end up casting it around my app
is there a better type to use or a way to cast on retreival? (i don't really need that much precision)3 Replies
You can use mapWith: https://orm.drizzle.team/docs/sql#sqlmapwith
Magical sql operator 🪄 - DrizzleORM
Drizzle ORM | %s
@luxaritas thanks for this, would I use this at the
pgTable
schema level or at the query level?I believe query level unless you use custom types?
You may also want to check if that column type has an alternate mode you can opt into when initializing it in the schema, I can’t remember off hand if it does