Skip to content

Commit

Permalink
Use NewItem for test
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 1, 2023
1 parent 7ebb4e7 commit eb8115b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/diesel_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<crate::Vector>,
}

#[derive(Debug, Insertable)]
#[diesel(table_name = items)]
struct NewItem {
pub embedding: Option<crate::Vector>,
}

#[test]
fn it_works() -> Result<(), diesel::result::Error> {
let mut conn = PgConnection::establish("postgres://localhost/pgvector_rust_test").unwrap();
Expand All @@ -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)
Expand Down

0 comments on commit eb8115b

Please sign in to comment.