Skip to content

RUST-1607: allow uuidRepresentation in connection string #838

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

Merged
merged 6 commits into from
Mar 13, 2023

Conversation

terakilobyte
Copy link
Member

This adds uuidRepresentation to ConnectionString.

I wasn't sure what to put for the documentation comment, it could probably be cleaned up.

@abr-egn abr-egn self-requested a review March 2, 2023 20:52
Copy link
Contributor

@abr-egn abr-egn left a comment

Choose a reason for hiding this comment

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

Looks mostly good! Just needs a pass through rustfmt and a couple of minor updates.

@@ -813,6 +815,10 @@ pub struct ConnectionString {
/// Default read preference for the client.
pub read_preference: Option<ReadPreference>,

/// The `uuidRepresentation` to use when decoding UuidOld bindata types. This serves as a caching
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion:

/// The `uuidRepresentation` to use when decoding UuidOld bindata types.  This is not used by the driver; client code can use this when deserializing relevant values with `to_uuid_with_representation`.

"javalegacy" => self.uuid_representation = Some(UuidRepresentation::JavaLegacy),
"pythonlegacy" => self.uuid_representation = Some(UuidRepresentation::PythonLegacy),
_ => return Err(ErrorKind::InvalidArgument {
message: format!("connection string `uuidRepresentation` option can be one of `csharpLegacy`, `javaLegacy`, or `pythonLegacy`. Received invalid `{value}`")
Copy link
Contributor

Choose a reason for hiding this comment

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

Sadly, our MSRV doesn't support inline format identifiers, so this will need to use the older format.

@abr-egn abr-egn requested a review from isabelatkinson March 2, 2023 21:26
Copy link
Contributor

@abr-egn abr-egn left a comment

Choose a reason for hiding this comment

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

LGTM! Opening up to Isabel.

@@ -813,6 +815,11 @@ pub struct ConnectionString {
/// Default read preference for the client.
pub read_preference: Option<ReadPreference>,

/// The `uuidRepresentation` to use when decoding UuidOld bindata types. This is not used by
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// The `uuidRepresentation` to use when decoding UuidOld bindata types. This is not used by
/// The [`UuidRepresentation`] to use when decoding [`Binary`] values with the `UuidOld` subtype. This is not used by

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should link to the proper bson types in the docs.rs documentation.

@@ -813,6 +815,11 @@ pub struct ConnectionString {
/// Default read preference for the client.
pub read_preference: Option<ReadPreference>,

/// The `uuidRepresentation` to use when decoding UuidOld bindata types. This is not used by
/// the driver; client code can use this when deserializing relevant values with
/// `to_uuid_with_representation`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// `to_uuid_with_representation`.
/// [`Binary::to_uuid_with_representation`].

Copy link
Contributor

@isabelatkinson isabelatkinson left a comment

Choose a reason for hiding this comment

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

lgtm other than patrick's doc suggestions!

@terakilobyte
Copy link
Member Author

Thanks for the feedback! I've updated it so the doc comments links appropriately, and looks halfway decent.

Copy link
Contributor

@patrickfreed patrickfreed left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the PR!

@abr-egn abr-egn merged commit c8f4e5f into mongodb:main Mar 13, 2023
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.

4 participants