We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e1980ff commit 9da2c75Copy full SHA for 9da2c75
v-model/src/storage/mod.rs
@@ -7,6 +7,7 @@ use std::fmt::Debug;
7
pub use async_bb8_diesel::{ConnectionError, PoolError};
8
use async_trait::async_trait;
9
use bb8::RunError;
10
+use diesel::result::{DatabaseErrorKind, Error as DieselError};
11
pub use diesel::result::Error as DbError;
12
#[cfg(feature = "mock")]
13
use mockall::automock;
@@ -43,6 +44,18 @@ pub enum StoreError {
43
44
Unknown,
45
}
46
47
+impl StoreError {
48
+ pub fn is_unique_conflict_err(&self) -> bool {
49
+ match self {
50
+ Self::Db(DieselError::DatabaseError(
51
+ DatabaseErrorKind::UniqueViolation,
52
+ _,
53
+ )) => true,
54
+ _ => false
55
+ }
56
57
+}
58
+
59
#[derive(Debug, PartialEq)]
60
pub struct ListPagination {
61
pub offset: i64,
0 commit comments