From d9b1b8f768af2f4015103b24a6d1f0d91084a0c6 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Wed, 13 Jul 2022 14:05:42 +0800 Subject: [PATCH] Datatype mappings of primitives (SeaQL/sea-orm#850, SeaQL/sea-schema#75) --- .../03-generate-entity/02-entity-structure.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/SeaORM/docs/03-generate-entity/02-entity-structure.md b/SeaORM/docs/03-generate-entity/02-entity-structure.md index cf23ca3169e..dbd33ed13d2 100644 --- a/SeaORM/docs/03-generate-entity/02-entity-structure.md +++ b/SeaORM/docs/03-generate-entity/02-entity-structure.md @@ -53,26 +53,26 @@ The column type will be derived automatically with the following mapping: For the mappings of Rust primitive data types. -| Rust type | Database Type
([`ColumnType`](https://docs.rs/sea-orm/*/sea_orm/entity/enum.ColumnType.html)) | -| --------- | ------------- | -| `String` | Char | -| `String` | String | -| `i8` | TinyInteger | -| `u8` | TinyUnsigned | -| `i16` | SmallInteger | -| `u16` | SmallUnsigned | -| `i32` | Integer | -| `u32` | Unsigned | -| `i64` | BigInteger | -| `u64` | BigUnsigned | -| `f32` | Float | -| `f64` | Double | -| `bool` | Boolean | -| `Vec` | Binary | +| Rust type | Database Type
([`ColumnType`](https://docs.rs/sea-orm/*/sea_orm/entity/enum.ColumnType.html)) | SQLite
datatype | MySQL
datatype | PostgreSQL
datatype | +| --------- | --------- | --------- | --------- | --------- | +| `String` | Char | text | char | char | +| `String` | String | text | varchar | varchar | +| `i8` | TinyInteger | integer | tinyint | smallint | +| `u8` | TinyUnsigned | integer | tinyint | smallint | +| `i16` | SmallInteger | integer | smallint | smallint | +| `u16` | SmallUnsigned | integer | smallint | smallint | +| `i32` | Integer | integer | int | integer | +| `u32` | Unsigned | integer | int | integer | +| `i64` | BigInteger | integer | bigint | bigint | +| `u64` | BigUnsigned | integer | bigint | bigint | +| `f32` | Float | real | float | real | +| `f64` | Double | real | double | double precision | +| `bool` | Boolean | integer | bool | bool | +| `Vec` | Binary | blob | blob | bytea | 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)) | SQLite datatype | MySQL datatype | PostgreSQL datatype +| 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 |