pub enum DbType {
Integer,
Text,
Blob,
Uuid,
Other,
}Expand description
A generic SQL storage class, independent of any data protocol.
This is the vocabulary the dialect names: a data domain (e.g. the tables
protocol) maps its own column types down to a DbType, and the dialect
turns that into a concrete backend type name via sql_type. The
Uuid variant is kept distinct from Blob so a backend may later map it
to a native UUID type rather than raw bytes.
Variants§
Integer
64-bit signed integer (INTEGER / BIGINT).
Text
UTF-8 text (TEXT).
Blob
Raw byte string (BLOB / BYTEA).
Uuid
16-byte UUID — stored as raw bytes today, but kept distinct from
Blob so a backend may later use a native UUID type.
Other
A column type the engine does not model (e.g. SQLite REAL/NUMERIC, a
Postgres enum). Produced only by backend introspection
(Db::describe_table) when a real table has
a column outside the engine’s vocabulary; the engine never emits it as
DDL. Schema reconciliation treats it as a mismatch rather than silently
coercing it to a class it isn’t.
Implementations§
Source§impl DbType
impl DbType
Sourcepub fn sql_type(self, dialect: SqlDialect) -> &'static str
pub fn sql_type(self, dialect: SqlDialect) -> &'static str
The concrete SQL column type name for this storage class under
dialect. SQLite uses type affinity (INTEGER/TEXT/BLOB) and has no
native UUID type, so a Uuid is stored as a raw BLOB. Postgres needs
BIGINT (its INTEGER is 32-bit and would overflow an i64) and BYTEA
for raw bytes, and maps Uuid to its native UUID type.