From 4310e259cae48512c48372660a6425ffd49ac75c Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 12 Jul 2022 19:54:53 +0800 Subject: [PATCH] Document datatype mappings (SeaQL/sea-orm#772) --- .../03-generate-entity/02-entity-structure.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/SeaORM/docs/03-generate-entity/02-entity-structure.md b/SeaORM/docs/03-generate-entity/02-entity-structure.md index 5845139ed44..4fda6e1f902 100644 --- a/SeaORM/docs/03-generate-entity/02-entity-structure.md +++ b/SeaORM/docs/03-generate-entity/02-entity-structure.md @@ -72,16 +72,16 @@ For the mappings of Rust primitive data types. For the mappings of Rust non-primitive data types. You can check [`entity/prelude.rs`](https://github.com/SeaQL/sea-orm/blob/master/src/entity/prelude.rs) for all of the reexported types. -| Rust type | Database Type
([`ColumnType`](https://docs.rs/sea-orm/*/sea_orm/entity/enum.ColumnType.html)) | -| --------- | ------------- | -| `Date`: chrono::NaiveDate
`TimeDate`: time::Date | Date | -| `Time`: chrono::NaiveTime
`TimeTime`: time::Time | Time | -| `DateTime`: chrono::NaiveDateTime
`TimeDateTime`: time::PrimitiveDateTime | DateTime | -| `DateTimeLocal`: chrono::DateTime<Local>
`DateTimeUtc`: chrono::DateTime<Utc> | Timestamp | -| `DateTimeWithTimeZone`: chrono::DateTime<FixedOffset>
`TimeDateTimeWithTimeZone`: time::OffsetDateTime | TimestampWithTimeZone | -| `Uuid`: uuid::Uuid | Uuid | -| `Json`: serde_json::Value | Json | -| `Decimal`: rust_decimal::Decimal | Decimal | +| Rust type | Database Type
([`ColumnType`](https://docs.rs/sea-orm/*/sea_orm/entity/enum.ColumnType.html)) | SQLite datatype | MySQL datatype | PostgreSQL datatype +| --------- | --------- | --------- | --------- | --------- | +| `Date`: chrono::NaiveDate
`TimeDate`: time::Date | Date | text | date | date | +| `Time`: chrono::NaiveTime
`TimeTime`: time::Time | Time | text | time | time | +| `DateTime`: chrono::NaiveDateTime
`TimeDateTime`: time::PrimitiveDateTime | DateTime | text | datetime | timestamp | +| `DateTimeLocal`: chrono::DateTime<Local>
`DateTimeUtc`: chrono::DateTime<Utc> | Timestamp | text | timestamp | N/A | +| `DateTimeWithTimeZone`: chrono::DateTime<FixedOffset>
`TimeDateTimeWithTimeZone`: time::OffsetDateTime | TimestampWithTimeZone | text | timestamp | timestamp with time zone | +| `Uuid`: uuid::Uuid | Uuid | text | binary(16) | uuid | +| `Json`: serde_json::Value | Json | text | json | json | +| `Decimal`: rust_decimal::Decimal | Decimal | real | decimal | decimal | You can override the default mappings between a Rust type and `ColumnType` by the `column_type` attribute.