Postgres functions in the ORM?
Hello everyone, I'm learning typescript and SQL (with drizzle) and I'm trying to make an api endpoint that has something like this
I'm updating attributes (name, owner, hidden...) that are sent from a PATCH request and some fields are optional so they could be null/undefined. COALESCE() here gives the original value in the column if the attributes are null. This sql query works but I would like to ask if its possible to do this without calling sql`` operator. Earlier i tried something like
But it did not let me compile, giving me this error instead
If there is a better way to go about what I'm trying to do, any help would be greatly appreciated!
2 Replies