添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

I have noticed that a mapping of pg REAL to rusts f32 does not seem to work and fails with the following error message:
Conversion(WrongType { postgres: Float8, rust: "f32" })'

According to the documentation postgres Float8 is postgres REAL which will map to rust f32. I have the following struct:

#[derive(Deserialize, PostgresMapper, Serialize)]
    #[pg_mapper(table = "data")]
    pub struct YearlyAverageTemperature {
        pub temperature: f32,

Query does contain one row only using client.query_one()

let result = client
            .query_one(&stmt, &[])
            .await?;
let temp = YearlyAverageTemperature::from_row_ref(&result).unwrap();

When changing the element in the struct to a f64 the conversion works without problems.