You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Model field with chrono::DateTime<chrono::Local> panic #1222
error[E0277]: the trait bound `DateTime<Local>: types::Type<MySql>` is not satisfied
--> C:\Users\10342\.cargo\registry\src\github.com-1ecc6299db9ec823\sqlx-core-0.5.5\src\any\type.rs:24:25
|
24 | <$ty as crate::types::Type<crate::mysql::MySql>>::compatible(&ty)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `types::Type<MySql>` is not implemented for `DateTime<Local>`
|
::: C:\Users\10342\.cargo\registry\src\github.com-1ecc6299db9ec823\sqlx-core-0.5.5\src\types\mod.rs:177:5
|
177 | fn compatible(ty: &DB::TypeInfo) -> bool {
| ---------------------------------------- required by `types::Type::compatible`
|
::: C:\Users\10342\.cargo\registry\src\github.com-1ecc6299db9ec823\sqlx-core-0.5.5\src\any\types.rs:127:1
|
127 | impl_any_type!(chrono::DateTime<chrono::offset::Local>);
| -------------------------------------------------------- in this macro invocation
|
= help: the following implementations were found:
<DateTime<Local> as types::Type<any::database::Any>>
<DateTime<Tz> as types::Type<Sqlite>>
<DateTime<Tz> as types::Type<postgres::database::Postgres>>
<DateTime<Utc> as types::Type<MySql>>
<DateTime<Utc> as types::Type<any::database::Any>>
= note: this error originates in the macro `impl_any_type` (in Nightly builds, run with -Z macro-backtrace for more info)
Have you searched for existing (closed) issues? I'm pretty sure this has been discussed multiple times already (though might also have been on Discord only).
Right, that's the only reference I can find too. I thought I had seen pretty much this exact issue before.
Actually I can't find Type implementations for DateTime<Local> for any database, only Decode impls for Postgres and SQLite. The files these are in is sqlx-core/src/{db}/types/chrono.rs. Shouldn't be too hard to adapt the code from postgres / sqlite to mysql and also add Type impls.
Activity
juzi5201314 commentedon Jun 13, 2021
me too!
jplatte commentedon Jun 13, 2021
Have you searched for existing (closed) issues? I'm pretty sure this has been discussed multiple times already (though might also have been on Discord only).
juzi5201314 commentedon Jun 14, 2021
emm, I searched for issues related to chrono, and only found this #1224... but the problem remains...
jplatte commentedon Jun 14, 2021
Right, that's the only reference I can find too. I thought I had seen pretty much this exact issue before.
Actually I can't find
Typeimplementations forDateTime<Local>for any database, onlyDecodeimpls for Postgres and SQLite. The files these are in issqlx-core/src/{db}/types/chrono.rs. Shouldn't be too hard to adapt the code from postgres / sqlite to mysql and also addTypeimpls.abonander commentedon Jul 21, 2021
This is also causing CI errors for the MySQL passes so I'm going to go ahead and fix this.
fix(mysql): implement type traits for `chrono::DateTime<Local>`
fix(mysql): implement type traits for `chrono::DateTime<Local>`
fix(mysql): implement type traits for `chrono::DateTime<Local>`
fix(mysql): implement type traits for `chrono::DateTime<Local>` (#1335)
Merge launchbadge/sqlx master into JetASAP/sqlx master (#12)
Update ws-support (#15)