(
ex: &mut PgConnection,
interaction: &Interaction,
order_uid: &OrderUid,
)
| 319 | |
| 320 | #[instrument(skip_all)] |
| 321 | pub async fn insert_or_overwrite_interaction( |
| 322 | ex: &mut PgConnection, |
| 323 | interaction: &Interaction, |
| 324 | order_uid: &OrderUid, |
| 325 | ) -> Result<(), sqlx::Error> { |
| 326 | const QUERY: &str = r#" |
| 327 | INSERT INTO interactions ( |
| 328 | order_uid, |
| 329 | index, |
| 330 | target, |
| 331 | value, |
| 332 | data, |
| 333 | execution |
| 334 | ) |
| 335 | VALUES ($1, $2, $3, $4, $5, $6) |
| 336 | ON CONFLICT (order_uid, index, execution) DO UPDATE |
| 337 | SET target = $3, |
| 338 | value = $4, data = $5 |
| 339 | "#; |
| 340 | sqlx::query(QUERY) |
| 341 | .bind(order_uid) |
| 342 | .bind(interaction.index) |
| 343 | .bind(interaction.target) |
| 344 | .bind(&interaction.value) |
| 345 | .bind(&interaction.data) |
| 346 | .bind(interaction.execution) |
| 347 | .execute(ex) |
| 348 | .await?; |
| 349 | Ok(()) |
| 350 | } |
| 351 | |
| 352 | /// One row in the `order_quotes` table. |
| 353 | #[derive(Clone, Default, Debug, PartialEq, sqlx::FromRow)] |
no test coverage detected