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

Add option to compare site_id when values are equal to determine ultimate winner #415

Merged
merged 9 commits into from
Dec 27, 2023

Conversation

jeromegn
Copy link
Contributor

@jeromegn jeromegn commented Dec 21, 2023

Adds 2 functions crsql_config_set(name, value) and crsql_config_get(name). They enable setting and getting config settings persisted to the database, but also available in crsql_ExtData.

The first and only setting right now is merge-equal-values making sure there's always a winner by tie-breaking on site_id when everything else is equal.

@jeromegn jeromegn marked this pull request as draft December 21, 2023 19:02
@jeromegn jeromegn marked this pull request as ready for review December 21, 2023 22:08
core/rs/core/src/c.rs Outdated Show resolved Hide resolved
core/rs/core/src/lib.rs Outdated Show resolved Hide resolved
@@ -1,2 +1,2 @@
// The sha of the commit that this version of crsqlite was built from.
pub const SHA: &'static str = "";
pub const SHA: &'static str = "3a01980562615001d765eec61e3ed58147a93f93";
Copy link
Collaborator

Choose a reason for hiding this comment

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

hm, I guess I should ignore this file and only generate it at build time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, possibly yes. I didn't notice it.

return 0;
}
} else {
// unhandled config setting
Copy link
Collaborator

Choose a reason for hiding this comment

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

return an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't quite sure which way to go there. I didn't want to be too strict for the list of supported config settings, but I did want to be strict for each setting's value type.

@tantaman tantaman merged commit da2e952 into vlcn-io:main Dec 27, 2023
9 checks passed
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