Sql_query with the Uuid type

Hello,

How do you use the Uuid type with the sql_query function ? I’ve created a model matching my query

#[derive(PartialEq, Debug, Queryable, QueryableByName)]
pub struct PostWithUserAndStatus {
    #[sql_type = "Uuid"] pub id: Uuid,
    #[sql_type = "Timestamp"] pub created_at: NaiveDateTime,
    #[sql_type = "Varchar"] pub photo_url: String,
    #[sql_type = "Varchar"] pub content: String,
    #[sql_type = "Varchar"] pub post_status: String,
    #[sql_type = "Varchar"] pub usertable_id: String,
    #[sql_type = "Varchar"] pub user_id: String, 
    #[sql_type = "Varchar"] pub user_name: String,
    #[sql_type = "Varchar"] pub firstname: String,
    #[sql_type = "Varchar"] pub lastname: String, 
    #[sql_type = "Varchar"] pub description: String,
    #[sql_type = "Varchar"] pub avatar_url: String,
    #[sql_type = "Varchar"] pub user_status: String
}

and I execute my query doing this

let post_result: Result<Vec<PostWithUserAndStatus>, Error> = sql_query(posts_with_user_sql)
        .load(&connection);

But the load function gives this error

the trait bound `uuid::Uuid: diesel::deserialize::FromSql<uuid::Uuid, diesel::pg::Pg>` is not satisfied

the trait `diesel::deserialize::FromSql<uuid::Uuid, diesel::pg::Pg>` is not implemented for `uuid::Uuid`

I’ve been trying to add the Serializable and Deserializable to my model derive but I got the same error

You use the wrong Uuid type in your #[sql_type] attribute. You need to use that one from diesel::sql_types::Uuid.