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

fix value serde in patch, comparison of complex values #22

Merged
merged 5 commits into from
Sep 30, 2024

Conversation

ldanilek
Copy link
Contributor

@ldanilek ldanilek commented Sep 25, 2024

patch and replace were not using jsonToConvex, so if you did db.patch(id, { foo: BigInt(1) }) and then db.get(id) it would throw an error because of the field name "$integer".

also fixes a bug i recently caused where db.patch(id, { foo: null }) would throw an error; whoops.

fix comparisons for complex values like BigInt and arrays, which weren't working, by copying the compare.ts function from the aggregate component. that library isn't perfect, for example i think it considers -0 and +0 to be equal, but it's better than the existing compareValues function which thinks ["a"] < ["a"] and {a:null} < {a: null}

added a test that covers all of the operations for all kinds of values.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@sshader sshader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants