(
ex: &mut PgConnection,
interaction: &Interaction,
order_uid: &OrderUid,
)
| 361 | |
| 362 | #[instrument(skip_all)] |
| 363 | pub async fn insert_or_overwrite_interaction( |
| 364 | ex: &mut PgConnection, |
| 365 | interaction: &Interaction, |
| 366 | order_uid: &OrderUid, |
| 367 | ) -> Result<(), sqlx::Error> { |
| 368 | const QUERY: &str = r#" |
| 369 | INSERT INTO interactions ( |
| 370 | order_uid, |
| 371 | index, |
| 372 | target, |
| 373 | value, |
| 374 | data, |
| 375 | execution |
| 376 | ) |
| 377 | VALUES ($1, $2, $3, $4, $5, $6) |
| 378 | ON CONFLICT (order_uid, index, execution) DO UPDATE |
| 379 | SET target = $3, |
| 380 | value = $4, data = $5 |
| 381 | "#; |
| 382 | sqlx::query(QUERY) |
| 383 | .bind(order_uid) |
| 384 | .bind(interaction.index) |
| 385 | .bind(interaction.target) |
| 386 | .bind(&interaction.value) |
| 387 | .bind(&interaction.data) |
| 388 | .bind(interaction.execution) |
| 389 | .execute(ex) |
| 390 | .await?; |
| 391 | Ok(()) |
| 392 | } |
| 393 | |
| 394 | /// One row in the `order_quotes` table. |
| 395 | #[derive(Clone, Default, Debug, PartialEq, sqlx::FromRow)] |
no test coverage detected