-
Hi all, I've been poking the docs and code for most of the day and I think I've finally hit a wall. Any tips on how to get the ids out of a I am using Postgres so From the docs and poking I've arrived let res: = Fruit::insert_many([apple, orange])
// Use returning to get the values back from the db
.exec_with_returning(db)
.await?; But in that scenario |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
https://github.com/SeaQL/sea-orm/blob/master/tests/returning_tests.rs#L145 shows an example for My understanding is that #1021 should be the insert version of the above support but no dice. https://github.com/SeaQL/sea-orm/blob/master/tests/returning_tests.rs#L52 is another example but that is only for the singular |
Beta Was this translation helpful? Give feedback.
-
Did you ever resolve this? Currently running into the same issue. |
Beta Was this translation helpful? Give feedback.
-
Released! https://github.com/SeaQL/sea-orm/releases/tag/1.1.6 assert_eq!(
cakes_bakers::Entity::insert_many([
cakes_bakers::ActiveModel {
cake_id: Set(1),
baker_id: Set(2),
},
cakes_bakers::ActiveModel {
cake_id: Set(2),
baker_id: Set(1),
},
])
.exec_with_returning_keys(db)
.await
.unwrap(),
[(1, 2), (2, 1)]
); |
Beta Was this translation helpful? Give feedback.
Released! https://github.com/SeaQL/sea-orm/releases/tag/1.1.6