-
Notifications
You must be signed in to change notification settings - Fork 180
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
Conversation
There was a problem hiding this 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.
src/client/options/mod.rs
Outdated
@@ -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 |
There was a problem hiding this comment.
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`.
src/client/options/mod.rs
Outdated
"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}`") |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
src/client/options/mod.rs
Outdated
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// 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 |
There was a problem hiding this comment.
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.
src/client/options/mod.rs
Outdated
@@ -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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// `to_uuid_with_representation`. | |
/// [`Binary::to_uuid_with_representation`]. |
There was a problem hiding this 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!
Thanks for the feedback! I've updated it so the doc comments links appropriately, and looks halfway decent. |
There was a problem hiding this 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!
This adds
uuidRepresentation
toConnectionString
.I wasn't sure what to put for the documentation comment, it could probably be cleaned up.