Skip to main content

orvanta_api/models/
conflict_mode.rs

1/*
2 * Orvanta API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.1.0
7 * Contact: contact@orvanta.cloud
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ConflictMode : What the target does with a row that collides with one already present. `error` is a plain `INSERT` (the default, and the behaviour of every run before #1216). `skip` is `INSERT ... ON CONFLICT DO NOTHING`, which makes re-sending an already-applied batch a no-op -- the only thing that lets a run resume across the window where the previous attempt's last batch may or may not have committed. `skip` is refused with a 400 if the target table has no unique constraint covering the mapped columns, since `ON CONFLICT DO NOTHING` would then never fire and would duplicate rather than skip.
15/// What the target does with a row that collides with one already present. `error` is a plain `INSERT` (the default, and the behaviour of every run before #1216). `skip` is `INSERT ... ON CONFLICT DO NOTHING`, which makes re-sending an already-applied batch a no-op -- the only thing that lets a run resume across the window where the previous attempt's last batch may or may not have committed. `skip` is refused with a 400 if the target table has no unique constraint covering the mapped columns, since `ON CONFLICT DO NOTHING` would then never fire and would duplicate rather than skip.
16#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17pub enum ConflictMode {
18    #[serde(rename = "error")]
19    Error,
20    #[serde(rename = "skip")]
21    Skip,
22
23}
24
25impl std::fmt::Display for ConflictMode {
26    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
27        match self {
28            Self::Error => write!(f, "error"),
29            Self::Skip => write!(f, "skip"),
30        }
31    }
32}
33
34impl Default for ConflictMode {
35    fn default() -> ConflictMode {
36        Self::Error
37    }
38}
39