objectbox / objectbox/objectbox-java
@Unique: more on conflict options
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 4.6k
- Forks
- 311
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
@Unique currently supports FAIL and REPLACE that are compatible with Sync.
Proposal to add more options (that likely will not work with Sync):
@Unique(onConflict=IGNORE): ignore the offending object (no changes to the existing conflicting object). If there are multiple unique properties in an entity, this strategy is evaluated first:
if the property conflicts, no other properties will be checked for conflicts.
@Unique(onConflict=UPDATE): the offending object overwrites the existing conflicting object while keeping its ID. Thus, all relations pointing to the existing entity stay intact.
This is useful for a "secondary" ID, e.g. a string "ID". Within an entity, this strategy may be used once only (update target would be ambiguous otherwise).
Multiple strategies in an entity are processed in this order: IGNORE, FAIL, REPLACE, UPDATE.
Originally posted by @greenrobot in https://github.com/objectbox/objectbox-java/issues/509#issuecomment-425055199
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Verwende dieses Issue als Ausgangspunkt und prüfe zunächst, wie @Unique derzeit FAIL und REPLACE behandelt. Als abgeschlossen gilt die Unterstützung der vorgeschlagenen Verhaltensweisen IGNORE und UPDATE, einschließlich ihrer Reihenfolge, der relationserhaltenden Update-Semantik und der Einschränkung für mehrere UPDATE-Strategien; der Payload nennt keine Dateien oder Tests.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- databases
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100