[diesel] trait diesel::Insertable is not implemented

Hey!

I'm pretty new to Diesel and I wanted to run this below piece of code and I got an error. Was wondering if anyone has any idea on why this is happening?

#[derive(Debug, Serialize, Deserialize, Clone, Insertable, AsChangeset)]
#[diesel(table_name = attachment_blobs)]
pub struct AttachmentBlobChangeset {
    pub key: String,
    pub file_name: String,
    pub content_type: Option<String>,
    pub byte_size: i64,
    pub checksum: String,
    pub service_name: String,
}

impl AttachmentBlob {
    pub fn create(db: &mut Connection, item: &AttachmentBlobChangeset) -> QueryResult<Self> {
        use super::schema::attachment_blobs::dsl::*;


        insert_into(attachment_blobs)
            .values(item)
            .get_result::<AttachmentBlob>(db)
    }

As you can see the Insertable is implemented for AttachmentBlobChangeset using derive but when I run this code, I get the below error:

the trait `diesel::Insertable<services::schema::postgres::attachment_blobs::table>` is not implemented for `services::attachment_blob::AttachmentBlobChangeset`

which is saying the trait is not implemented whereas it is.
It is also important to note that the whole code is written in attachment_blob.rs inside of services folder.
Any idea?

Cross post to trait diesel::Insertable is not implemented · diesel-rs/diesel · Discussion #4040 · GitHub

(The question is missing important details to be answered)

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.