Skip to main content

Entity Structure

Column

Column Type

The column type will be derived automatically with the following mapping:

For the mappings of Rust primitive data types.

Rust typeDatabase Type
(ColumnType)
MSSQL
datatype
StringCharnchar
StringStringnvarchar
i8TinyIntegertinyint
u8TinyUnsignedtinyint
i16SmallIntegersmallint
u16SmallUnsignedsmallint
i32Integerint
u32Unsignedint
i64BigIntegerbigint
u64BigUnsignedbigint
f32Floatreal
f64Doublefloat
boolBooleanbit
Vec<u8>Binarybinary

For the mappings of Rust non-primitive data types. You can check entity/prelude.rs for all of the reexported types.

Rust typeDatabase Type
(ColumnType)
MSSQL
datatype
Date: chrono::NaiveDate
TimeDate: time::Date
Datedate
Time: chrono::NaiveTime
TimeTime: time::Time
Timetime
DateTime: chrono::NaiveDateTime
TimeDateTime: time::PrimitiveDateTime
DateTimedatetime
DateTimeLocal: chrono::DateTime<Local>
DateTimeUtc: chrono::DateTime<Utc>
Timestampdatetime2
DateTimeWithTimeZone: chrono::DateTime<FixedOffset>
TimeDateTimeWithTimeZone: time::OffsetDateTime
TimestampWithTimeZonedatetimeoffset
Uuid: uuid::Uuid, uuid::fmt::Braced, uuid::fmt::Hyphenated, uuid::fmt::Simple, uuid::fmt::UrnUuiduniqueidentifier
Json: serde_json::ValueJsonnvarchar(max)
Decimal: rust_decimal::DecimalDecimaldecimal