Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion SeaORM/docs/04-generate-entity/03-column-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ For the mappings of Rust primitive data types:
| `i32` | Integer | integer | int | integer |
| `u32` | Unsigned | integer | int unsigned | N/A |
| `i64` | BigInteger | integer | bigint | bigint |
| `u64` | BigUnsigned | integer | bigint unsigned | N/A |
| `u64` | BigUnsigned | unsupported[^u64-sqlite] | bigint unsigned | N/A |
| `f32` | Float | float | float | real |
| `f64` | Double | double | double | double precision |
| `bool` | Boolean | boolean | bool | bool |
| `Vec<u8>` | Binary | blob | blob | bytea |

[^u64-sqlite]: `u64` is not supported on SQLite. SQLite stores only 64-bit *signed* integers, and the underlying `sqlx` SQLite driver does not encode `u64` (values above `i64::MAX` cannot be represented). Use `i64`, or store large unsigned values as `String` / `Vec<u8>`. See [#1400](https://github.com/SeaQL/sea-orm/issues/1400).

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 <br/> ([`ColumnType`](https://docs.rs/sea-orm/2.0.0/sea_orm/entity/enum.ColumnType.html)) | SQLite <br/> datatype | MySQL <br/> datatype | PostgreSQL <br/> datatype |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ Rust 基本数据类型的映射:
| `i32` | Integer | integer | int | integer |
| `u32` | Unsigned | integer | int unsigned | N/A |
| `i64` | BigInteger | integer | bigint | bigint |
| `u64` | BigUnsigned | integer | bigint unsigned | N/A |
| `u64` | BigUnsigned | 不支持[^u64-sqlite] | bigint unsigned | N/A |
| `f32` | Float | float | float | real |
| `f64` | Double | double | double | double precision |
| `bool` | Boolean | boolean | bool | bool |
| `Vec<u8>` | Binary | blob | blob | bytea |

[^u64-sqlite]: SQLite 不支持 `u64`。SQLite 仅存储 64 位*有符号*整数,且底层 `sqlx` SQLite 驱动无法编码 `u64`(无法表示大于 `i64::MAX` 的值)。请改用 `i64`,或将较大的无符号值存储为 `String` / `Vec<u8>`。参见 [#1400](https://github.com/SeaQL/sea-orm/issues/1400)。

Rust 非基本数据类型的映射。你可以查看 [`entity/prelude.rs`](https://github.com/SeaQL/sea-orm/blob/master/src/entity/prelude.rs) 了解所有重新导出的类型。

| Rust type | Database Type <br/> ([`ColumnType`](https://docs.rs/sea-orm/2.0.0-rc.25/sea_orm/entity/enum.ColumnType.html)) | SQLite <br/> datatype | MySQL <br/> datatype | PostgreSQL <br/> datatype |
Expand Down