VarBinary(16) column breaks DeriveEntityModel derive
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
Description
After successfully importing the entity for a table containing a VarBinary(16) field, I am unable to build due to an error originating from the DeriveEntityModel derive in the entities Model struct.
Steps to Reproduce
- Import a table with a VarBinary(16) column
- Attempt to build with 'cargo build'
Expected Behavior
Program builds.
Actual Behavior
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "EventLog")]
pub struct Model {
#[sea_orm(primary_key, unique)]
pub event_log_id: i32,
pub event_type_id: i32,
pub user: String,
pub timestamp: DateTime,
#[sea_orm(column_type = "VarBinary(16)")]
pub ip_address: Vec<u8>,
pub event: Json,
}
error[E0308]: mismatched types
--> src\entities\event_log.rs:5:35
|
5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
| ^^^^^^^^^^^^^^^^^
| |
| expectedStringLen, found integer
| arguments to this enum variant are incorrect
Reproduces How Often
Every time.
Workarounds
None.
Versions
MySQL 8.0.35 compiled for Linux (x86_64)
Windows 11 Version 10.0.22631 Build 22631
sea-orm v1.0.0
sea-orm-macros v1.0.0 (proc-macro)
sea-bae v0.2.0 (proc-macro)
sea-query v0.31.0
sea-query-binder v0.6.0
sea-query v0.31.0 (*)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with cargo build using the generated src/entities/event_log.rs Model and its VarBinary(16) column_type. Read the DeriveEntityModel derive involved in the error and verify the generated entity compiles successfully with the Vec field; done means the reported E0308 mismatch no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100