News for hackers. Stuff that matters.
Re:Rust-Query by kelnos on Saturday November 30, 2024 @05:49PM (#42284620)
> That has not been my experience

Well, it has been mine. That trick you suggested works for the simple binary "either include this WHERE clause filter or don't" -- which, agreed, is something that comes up often enough -- but it's only in the simplest of CRUD apps where that's all I've needed.

A quick example: I have a REST endpoint that updates a resource. The JSON fields that map to the DB columns can be missing (leave the column value unchanged), null (set the column value to NULL), or have a value (set the new provided value). The list of assignments in the UPDATE needs to be dynamic; sometimes there might be only one column being updated, sometimes two, three, four five...

Re:Rust-Query by jon_richards on Sunday December 01, 2024 @06:06AM (#42287718)
Isn’t the standard just to set the unchanged column to itself?
Re:Rust-Query by Diggsey on Monday December 02, 2024 @10:19AM (#42297038)
In this case you just set the column value to the existing value...