I have this code:
pub fn from(query: Query(a), table: String) -> Query(a) {
case query {
// Select(what, decoder, from, where) -> Select(what, decoder, From(table), where)
Select(..) -> Select(..query, from: From(table))
CreateTable(..) -> panic
}
}
it produces the following error
error: Unsafe record update
┌─ /home/grfork/reps/wind_world_rpg/src/sql/yoursql.gleam:77:19
│
77 │ Select(..) -> Select(..query, from: From(table))
│ ^^^^^^ I can't tell this is always the right constructor
This type has multiple constructors so it cannot be safely updated.
If this value was one of the other variants then the update would be
produce incorrect results.
Consider pattern matching on it with a case expression and then
constructing a new record with its values.
How do I use the syntax correctly here? The syntax with destructuring every single field works fine, it is commented in the code
