ActiveObject-like object patch #409
Replies: 1 comment 7 replies
-
|
Your I'd like to make it so that you can have a new variable I'm not sure yet how to design this better. Thinking of: // data has type { paidTime: Date }, and this should override { paidTime?: Date } of the order
const updatedOrder = await db.order.find(id).update(data).assign(order)If you select some fields, it will populate selected fields + updated fields into the object: // resulting type will have both foo and bar
const updatedOrder = await db.order.find(id).update({ foo: 1 }).select('bar').assign(order)If it's It's not Though, Seems to be fine so far. What do you think about my non-mutative idea over yours mutative one? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Relatively often I find myself using this (simplified) flow:
This is of course expected and I'm not complaining. However, this is still:
My idea is, can we somehow simplify this on ORM level? Such as:
Of course there are many questions, such as how to handle multiple objects, what to do if object has no respective keys (or what if they've been selected under aliases), etc. etc. — but I just wanted to start a discussion here.
Edit: see #410 as well.
Beta Was this translation helpful? Give feedback.
All reactions