diff --git a/src/diesel_ext.rs b/src/diesel_ext.rs index bfbc4c5..777e225 100644 --- a/src/diesel_ext.rs +++ b/src/diesel_ext.rs @@ -79,13 +79,19 @@ mod tests { } } - #[derive(Debug, Insertable, PartialEq, Queryable)] + #[derive(Debug, PartialEq, Queryable)] #[diesel(table_name = items)] struct Item { pub id: i32, pub embedding: Option, } + #[derive(Debug, Insertable)] + #[diesel(table_name = items)] + struct NewItem { + pub embedding: Option, + } + #[test] fn it_works() -> Result<(), diesel::result::Error> { let mut conn = PgConnection::establish("postgres://localhost/pgvector_rust_test").unwrap(); @@ -95,22 +101,16 @@ mod tests { .execute(&mut conn)?; let new_items = vec![ - Item { - id: 1, + NewItem { embedding: Some(Vector::from(vec![1.0, 1.0, 1.0])), }, - Item { - id: 2, + NewItem { embedding: Some(Vector::from(vec![2.0, 2.0, 2.0])), }, - Item { - id: 3, + NewItem { embedding: Some(Vector::from(vec![1.0, 1.0, 2.0])), }, - Item { - id: 4, - embedding: None, - }, + NewItem { embedding: None }, ]; diesel::insert_into(items::table)