#[non_exhaustive]pub enum SqlErrorKind {
Show 19 variants
UniqueViolation,
ForeignKeyViolation,
NotNullViolation,
CheckViolation,
ExclusionViolation,
SerializationFailure,
DeadlockDetected,
QueryCanceled,
LockNotAvailable,
InFailedTransaction,
ConnectionFailure,
TooManyConnections,
UndefinedTable,
UndefinedColumn,
SyntaxError,
InvalidTextRepresentation,
StringDataRightTruncation,
NumericValueOutOfRange,
Other,
}Expand description
SQLSTATE 归一后的错误类别。
覆盖 PostgreSQL 与 MySQL 的常见完整性/并发/连接错误;未识别码落到
SqlErrorKind::Other,调用方仍可通过 SqlErrorInfo::code 读原始码。
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
UniqueViolation
唯一约束冲突(SQLSTATE 23505 / MySQL 23000 且报文可判定)。
ForeignKeyViolation
外键约束冲突(23503)。
NotNullViolation
非空约束冲突(23502)。
CheckViolation
CHECK 约束冲突(23514)。
ExclusionViolation
排他约束冲突(23P01)。
SerializationFailure
序列化失败,可整事务重试(40001)。
DeadlockDetected
死锁检测,可整事务重试(40P01)。
QueryCanceled
查询被取消(57014)。
LockNotAvailable
锁不可用(55P03)。
InFailedTransaction
事务已中止,必须先 ROLLBACK(25P02)。
ConnectionFailure
连接失败/断开(08000/08003/08006 等)。
TooManyConnections
连接数超限(53300)。
UndefinedTable
表不存在(42P01 / MySQL 42S02)。
UndefinedColumn
列不存在(42703)。
SyntaxError
SQL 语法错误(42601 / 42000)。
InvalidTextRepresentation
文本表示的输入非法(22P02)。
StringDataRightTruncation
字符串超长(22001)。
NumericValueOutOfRange
数值超出范围(22003)。
Other
未归一的 SQLSTATE。
Trait Implementations§
Source§impl Clone for SqlErrorKind
impl Clone for SqlErrorKind
impl Copy for SqlErrorKind
Source§impl Debug for SqlErrorKind
impl Debug for SqlErrorKind
impl Eq for SqlErrorKind
Source§impl PartialEq for SqlErrorKind
impl PartialEq for SqlErrorKind
impl StructuralPartialEq for SqlErrorKind
Auto Trait Implementations§
impl Forget for SqlErrorKind
impl Freeze for SqlErrorKind
impl Move for SqlErrorKind
impl RefUnwindSafe for SqlErrorKind
impl Send for SqlErrorKind
impl Sync for SqlErrorKind
impl Unpin for SqlErrorKind
impl UnsafeUnpin for SqlErrorKind
impl UnwindSafe for SqlErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more