-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid deserialization for MySQL's Decimal type #122
Comments
Upon further inspection, I found that the data struct in the generated code is pub struct Data {
#[serde(rename = "id")]
pub id: i32,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "amount")]
pub amount: f64,
#[serde(rename = "date")]
pub date: chrono::DateTime<chrono::FixedOffset>,
#[serde(rename = "comment")]
pub comment: Option<String>,
#[serde(rename = "incomes_categories_id")]
pub incomes_categories_id: Option<i32>,
} Notice that the amount field is I manually change the field from |
Native types like |
Is there a way to configure the schema so that a decimal field can be deserialized into a string without having to hand edit the generated code ? |
Not right now, sorry |
I'm having a MySQL table as follows:
and I'm querying it like this
however I'm getting an error
it seems to me that the deserialization failed for the
amount
field which in MySQL Type is adecimal
and in rust it should be returned as af64
. Somehowstring
type got mixed in and the deserialization failed.The text was updated successfully, but these errors were encountered: