-
Notifications
You must be signed in to change notification settings - Fork 690
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: EXPOSED-436 Allow using insert values on update with upsert() (#…
…2172) * feat: EXPOSED-436 Allow using insert values on update with upsert() onUpdate parameter of upsert() (and batchUpsert()) currently accepts a list of columns to include in the UPDATE clause and the values/expressions to use. It is not possible to refer to the values that would have been inserted had there been no conflict. The onUpdate parameter now accepts a lambda with an UpsertStatement as its receiver, so that it has access to new expression `asForInsert()`. This makes it possible to reference these values using database-specific syntax like EXCLUDE, VALUES(), and alias identifier notation. Additional: - To limit duplication across UpsertStatement and BatchUpsertStatement, a new interface, UpsertBuilder, is included to house common logic. This removes business logic from FunctionProvider for everything up to statement preparation. * feat!: EXPOSED-436 Allow using insert values on update with upsert() Deprecate existing upsert functions and replace with variants that do not have onUpdate parameter. This functionality is now accomplished using onUpdate() in the upsert lambda directly, which utilizes UpdateStatement to set column-value assignments. Change asForInsert() to accept arguments instead of column receivers and rename to insertValue(). Change visibility modifier of some interface functions to internal. Update documentation with new upsert builder construct
- Loading branch information
Showing
13 changed files
with
433 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.