[−][src]Module sqlx::mysql::types
This is supported on
feature="mysql"
only.Conversions between Rust and MySQL types.
Types
Rust type | MySQL type(s) |
---|---|
bool | TINYINT(1) |
i8 | TINYINT |
i16 | SMALLINT |
i32 | INT |
i64 | BIGINT |
u8 | TINYINT UNSIGNED |
u16 | SMALLINT UNSIGNED |
u32 | INT UNSIGNED |
u64 | BIGINT UNSIGNED |
f32 | FLOAT |
f64 | DOUBLE |
&str , String | VARCHAR, CHAR, TEXT |
&[u8] , Vec<u8> | VARBINARY, BINARY, BLOB |
chrono
Requires the chrono
Cargo feature flag.
Rust type | MySQL type(s) |
---|---|
chrono::DateTime<Utc> | TIMESTAMP |
chrono::DateTime<Local> | TIMETAMP |
chrono::NaiveDateTime | DATETIME |
chrono::NaiveDate | DATE |
chrono::NaiveTime | TIME |
time
Requires the time
Cargo feature flag.
Rust type | MySQL type(s) |
---|---|
time::PrimitiveDateTime | DATETIME |
time::OffsetDateTime | TIMESTAMP |
time::Date | DATE |
time::Time | TIME |
Nullable
In addition, Option<T>
is supported where T
implements Type
. An Option<T>
represents
a potentially NULL
value from MySQL.