1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Database-backed enumerations.
//!
//! A [`DbEnum`] is a Rust enum stored in the database as one of a fixed set of
//! text values. Deriving it (`#[derive(DbEnum)]`) is the normal path: the derive
//! fills in the metadata below and also generates [`BindValue`](crate::BindValue)
//! and [`FromValue`](crate::FromValue), so the enum can be used directly as a
//! model field (with `#[field(db_enum)]`), bound as a query parameter, and read
//! back from a result row.
//!
//! The column is rendered as a native `ENUM(...)` on MySQL and as a text column
//! plus a `CHECK (... IN (...))` constraint on dialects without a native enum
//! type, so a bad value is rejected by the database on every backend.
use crateSqlType;
/// A Rust enum mapped to a fixed set of stored text values.