You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: update README to document conditional upserts feature (#60)
- Add conditional upserts to features list
- Add comprehensive section explaining conditional upserts
- Include usage examples with comparison operators
- Update SQL examples to show conditional syntax for MySQL and PostgreSQL
- Document practical use cases like optimistic locking and concurrent updates
Copy file name to clipboardExpand all lines: README.md
+57Lines changed: 57 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ all correct and functional.
19
19
20
20
- Upsert a single entity or a list of entities
21
21
- Support for custom ON clauses and ignored fields
22
+
- Conditional upserts with comparison operators (>, >=, <, <=)
22
23
- Compatible with Spring Data JPA repositories
23
24
- Database-specific optimizations for MySQL and PostgreSQL
24
25
- Automatic handling of generated keys
@@ -140,6 +141,41 @@ The method name is parsed to extract the following information:
140
141
-`Ignoring<FieldName>`: The field(s) to ignore during updates (e.g., `IgnoringUpdatedAt`)
141
142
-`IgnoringAllFields`: Whether to ignore all fields during updates (only insert new rows)
142
143
144
+
### Conditional Upserts
145
+
146
+
Since version 1.3.0, the library supports conditional upserts using the `When` clause in method names. This allows you to specify conditions under which the update should occur, preventing updates when certain conditions are not met.
147
+
148
+
You can use comparison operators to check field values:
149
+
-`More` (>): Update only when the new value is greater than the existing value
150
+
-`MoreOrEqual` (>=): Update only when the new value is greater than or equal to the existing value
151
+
-`Less` (<): Update only when the new value is less than the existing value
152
+
-`LessOrEqual` (<=): Update only when the new value is less than or equal to the existing value
0 commit comments