Skip to content

Diesel AsChangeset #2

@mjanda

Description

@mjanda

Hello,
I'm trying to use ArrayString with diesel and it fails to derive AsChangeset.

table! {
    ...
    users (id) {
        ...
        password_hash -> Varchar,
        ...
    }
}

type PasswordHash = ArrayString<U64>;

#[derive(AsChangeset, Default, Debug)]
#[table_name = "users"]
pub struct UserSettingsChangeset {
    pub password_hash: Option<PasswordHash>,
    ...
}

will lead to:

type mismatch resolving

  • <&arraystring::ArrayString<arraystring::typenum::UInt<arraystring::typenum::UInt<arraystring::typenum::UInt<arraystring::typenum::UInt<arraystring::typenum::UInt<arraystring::typenum::UInt<arraystring::typenum::UTerm, arraystring::typenum::B1>, arraystring::typenum::B1>, arraystring::typenum::B0>, arraystring::typenum::B0>, arraystring::typenum::B1>, arraystring::typenum::B0>> as diesel::Expression>::SqlType == diesel::sql_types::Nullable<diesel::sql_types::Text>
  • expected struct diesel::sql_types::Text, found struct diesel::sql_types::Nullable
  • expected struct diesel::sql_types::Text
    found struct diesel::sql_types::Nullable<diesel::sql_types::Text>

It works with normal String...Option<T> in AsChangeset should just skip the field during update.

Any ideas what I'm doing wrong? Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions