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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

CRDT for add/remove #1936

wants to merge 1 commit into from

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
  • Update documentation of Collection.modify()
  • Update documentation of Table.update()
  • Update documentation of Consistency in Dexie Cloud

* number or bigint properties (add/subtract)
* array properties (treating array as a set)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Status: In progress
Development

Successfully merging this pull request may close these issues.

None yet

1 participant