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