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

FromSqlRow is not implemented for uuid::Uuid #896

Closed
ernestas-poskus opened this Issue May 10, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@ernestas-poskus

ernestas-poskus commented May 10, 2017

the trait diesel::types::FromSqlRow<diesel::types::Uuid, diesel::pg::Pg> is not implemented for uuid::Uuid

I get ☝️ on insert from get_result binding. Looks like binding of UUID fields does not work or is broken unless I am doing something wrong.

        let connection = try!(db::postgresql().get());
        insert(&user)
            .into(users::table)
            .get_result::<User>(&*connection)
            .map_err(convert::Into::into)
[dependencies]
iron = "0.5.1"
router = "0.5.1"
mount = "0.3.0"
lazy_static = "0.2.8"
num_cpus = "1.4.0"
log = "0.3.7"
env_logger = "0.4.2"
logger = "0.3.0"
diesel = { version = "0.12.0", default-features = false, features = ["postgres", "chrono", "uuid", "serde_json"] }
diesel_codegen = { version = "0.12.0", default-features = false, features = ["postgres"] }
dotenv = "0.10.0"
r2d2 = "0.7.2"
r2d2-diesel = "0.12.0"
quick-error = "1.2.0"
chrono = { version = "0.3.1", features = ["serde"] }
serde = "1.0.2"
serde_derive = "1.0.2"
serde_json = "1.0.2"
uuid = "0.5.0"
params = "0.6.0"
bcrypt = "0.1.3"
use chrono;
use uuid::Uuid;
use schema::users;
use schema::campaigns;
use diesel::prelude::*;

#[derive(Debug, Identifiable, Queryable, Associations, Serialize, Deserialize)]
#[has_many(campaigns)]
#[belongs_to(tokens)]
pub struct User {
    id: i64,
    email: String,
    #[serde(skip_serializing, skip_deserializing)]
    uuid: Uuid,
    #[serde(skip_serializing, skip_deserializing)]
    password_hash: String,
    created_at: chrono::DateTime<chrono::UTC>,
    updated_at: chrono::DateTime<chrono::UTC>,
}
@Eijebong

This comment has been minimized.

Member

Eijebong commented May 10, 2017

Diesel 0.12 doesn't support serde 1.0 nor uuid 5.0

If you want to use them, use diesel master branch.

@sgrif sgrif closed this May 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment