(constraint: Option<String>, detail: Option<String>)
| 53 | |
| 54 | impl PersistenceError { |
| 55 | pub fn unique_violation(constraint: Option<String>, detail: Option<String>) -> Self { |
| 56 | let constraint_msg = constraint |
| 57 | .as_ref() |
| 58 | .map(|value| format!(" on {value}")) |
| 59 | .unwrap_or_default(); |
| 60 | Self::UniqueViolation { |
| 61 | constraint, |
| 62 | detail, |
| 63 | constraint_msg, |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | pub fn is_unique_violation_on(&self, constraint: &str) -> bool { |
| 68 | matches!( |
nothing calls this directly
no outgoing calls
no test coverage detected