prisma-client-go icon indicating copy to clipboard operation
prisma-client-go copied to clipboard

Restructure methods to sound more obvious

Open steebchen opened this issue 3 years ago • 2 comments

Right now the syntax is

.FindOne(...).Update(...)

While that results in one efficient query under the hood, it may not look like it.

To make this more obvious, we could revert to the previous API:

.UpdateOne(...).Data(...)

One question here is what we name the second parameter where the actual update happens; Data is what I'd probably default to.

steebchen avatar Nov 24 '20 14:11 steebchen

This would be a breaking change which everyone would need to adapt. I'm not sure if it's worth adding the new methods first and only deprecating the old methods.

steebchen avatar Nov 24 '20 14:11 steebchen

I like this syntax. It is more aligned with the underlying query as your suggested. I would maybe change Data to Values

tarrencev avatar Jan 12 '21 00:01 tarrencev