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 support for UUIDs #50

Merged
merged 3 commits into from
Jun 15, 2016
Merged

Add support for UUIDs #50

merged 3 commits into from
Jun 15, 2016

Conversation

dfaust
Copy link
Contributor

@dfaust dfaust commented Jun 14, 2016

This commit implements the FromValue trait for the Uuid type.
It is quite convenient to do that because it reduces the boilerplate when writing SQL queries.
It's an optional feature so, no new dependencies are introduced by default.

I understand that UUIDs are not an official SQL type, but since traits can only be implemented in either the crate the trait or the struct was defined in, this feature has to be implemented in either the uuid or the mysql crate. And doing that in the uuid crate would obviously be wrong.

Implement FromValue for the Uuid type.
@blackbeam
Copy link
Owner

blackbeam commented Jun 15, 2016

Thanks. I will look into it.

Could you please leave that message in #36 :

I license past and future contributions under the dual MIT/Apache-2.0 license, allowing licensees to chose either at their option

fn new(v: Value) -> MyResult<UuidIr> {
match v {
Value::Bytes(bytes) => match Uuid::from_bytes(bytes.as_slice()) {
Ok(val) => Ok(UuidIr { val: val }),
Copy link
Owner

Choose a reason for hiding this comment

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

Please move bytes into UuidIr here to not to reallocate on rollback.

@blackbeam blackbeam merged commit 9bdb218 into blackbeam:master Jun 15, 2016
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