Open minhtri1396 opened 1 week ago
Could we design the API to look something like this and place it in the datatypes package?
casewhen := datatypes.When("name = ?", "123").Then("hello").
When("name = ?", "234").Then("hello2").
Else("hello3")
db.Model(&user).Where("id = ?", 1).Update(map[string]any{"name": casewhen})
What did this pull request do?
Implement
case-when
expression to usecase-when
in SQLquery
.User Case Description
We can use this expression to update batches instead of single update.
The generated SQL will be: