Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRDT for add/remove #1936

Merged
merged 2 commits into from
May 24, 2024
Merged

CRDT for add/remove #1936

merged 2 commits into from
May 24, 2024

Conversation

dfahlander
Copy link
Collaborator

@dfahlander dfahlander commented Mar 29, 2024

  • number or bigint properties (add/subtract)
  • array properties (treating array as a set)

Mathematical addition Example

import { add } from "dexie";
db.friends.update(1, {
  age: add(1)
});
// Equivalent to:
db.friends.update(1, friend => ++friend.age);
// ...but works consistently in sync

Set addition Example

import { add } from "dexie";
db.friends.update(1, {
  interests: add(["football"])
});
// Equivalent to:
db.friends.update(1, friend => friend.interests = [...friend.interests, "football"].sort());
// ...but works consistently in sync

Checklist

  • Unit tests
  • Implementation
  • Support in Dexie Cloud Server (version 1.6.0)
  • Update documentation of Consistency in Dexie Cloud
  • Add documentation of replacePrefix()
  • Add documentation of add()
  • Add documentation of remove()
  • Update documentation of Collection.modify()
  • Update documentation of Table.update()

* number or bigint properties (add/subtract)
* array properties (treating array as a set)
@dfahlander dfahlander marked this pull request as ready for review May 24, 2024 14:51
@dfahlander dfahlander merged commit 1430bd1 into master May 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant