prisma / quaint

SQL Query AST and Visitor for Rust
Apache License 2.0
582 stars 61 forks source link

Cannot use/build with feature single-postgresql #430

Open KrullBorg opened 1 year ago

KrullBorg commented 1 year ago

I want to try quaint with postgresql. But i cannot build using feature single-postgresql (it works with single-sqlite).

Running cargo build i get following errors

error[E0277]: the trait bound `Decimal: tokio_postgres::types::FromSql<'_>` is not satisfied
   --> /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/postgres/conversion.rs:103:52
    |
103 |                 PostgresType::NUMERIC => match row.try_get(i)? {
    |                                                    ^^^^^^^ the trait `tokio_postgres::types::FromSql<'_>` is not implemented for `Decimal`
    |
    = help: the following other types implement trait `tokio_postgres::types::FromSql<'a>`:
              &'a [u8]
              &'a str
              DateTime<FixedOffset>
              DateTime<Local>
              DateTime<Utc>
              EnumString
              HashMap<std::string::String, Option<std::string::String>, S>
              IpAddr
            and 22 others
    = note: required for `Option<Decimal>` to implement `tokio_postgres::types::FromSql<'_>`
note: required by a bound in `tokio_postgres::Row::try_get`
   --> /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-postgres-0.5.5/src/row.rs:158:12
    |
158 |         T: FromSql<'a>,
    |            ^^^^^^^^^^^ required by this bound in `tokio_postgres::Row::try_get
error[E0277]: the trait bound `Decimal: tokio_postgres::types::FromSql<'_>` is not satisfied
   --> /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/postgres/conversion.rs:212:58
    |
212 |                 PostgresType::NUMERIC_ARRAY => match row.try_get(i)? {
    |                                                          ^^^^^^^ the trait `tokio_postgres::types::FromSql<'_>` is not implemented for `Decimal`
    |
    = help: the following other types implement trait `tokio_postgres::types::FromSql<'a>`:
              &'a [u8]
              &'a str
              DateTime<FixedOffset>
              DateTime<Local>
              DateTime<Utc>
              EnumString
              HashMap<std::string::String, Option<std::string::String>, S>
              IpAddr
            and 22 others
    = note: required for `Vec<Decimal>` to implement `tokio_postgres::types::FromSql<'_>`
    = note: 1 redundant requirement hidden
    = note: required for `Option<Vec<Decimal>>` to implement `tokio_postgres::types::FromSql<'_>`
note: required by a bound in `tokio_postgres::Row::try_get`
   --> /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-postgres-0.5.5/src/row.rs:158:12
    |
158 |         T: FromSql<'a>,
    |            ^^^^^^^^^^^ required by this bound in `tokio_postgres::Row::try_get`

error[E0599]: no method named `to_sql` found for struct `Decimal` in the current scope
   --> /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/postgres/conversion.rs:299:52
    |
299 |                     Decimal::from_str(&s).unwrap().to_sql(ty, out)
    |                                                    ^^^^^^ method not found in `Decimal`

error[E0599]: the method `to_sql` exists for reference `&Decimal`, but its trait bounds were not satisfied
   --> /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/postgres/conversion.rs:301:28
    |
301 |                 _ => float.to_sql(ty, out),
    |                            ^^^^^^ method cannot be called on `&Decimal` due to unsatisfied trait bounds
    |
   ::: /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_decimal-1.27.0/src/decimal.rs:124:1
    |
124 | pub struct Decimal {
    | ------------------ doesn't satisfy `Decimal: tokio_postgres::types::ToSql`
    |
    = note: the following trait bounds were not satisfied:
            `Decimal: tokio_postgres::types::ToSql`
            which is required by `&Decimal: tokio_postgres::types::ToSql`

error[E0599]: no method named `to_sql` found for struct `Decimal` in the current scope
   --> /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/postgres/conversion.rs:341:52
    |
341 |                     Decimal::from_str(&s).unwrap().to_sql(ty, out)
    |                                                    ^^^^^^ method not found in `Decimal`

error[E0599]: the method `to_sql` exists for reference `&Decimal`, but its trait bounds were not satisfied
   --> /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/quaint-0.1.13/src/connector/postgres/conversion.rs:343:28
    |
343 |                 _ => float.to_sql(ty, out),
    |                            ^^^^^^ method cannot be called on `&Decimal` due to unsatisfied trait bounds
    |
   ::: /home/andreaz/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_decimal-1.27.0/src/decimal.rs:124:1
    |
124 | pub struct Decimal {
    | ------------------ doesn't satisfy `Decimal: tokio_postgres::types::ToSql`
    |
    = note: the following trait bounds were not satisfied:
            `Decimal: tokio_postgres::types::ToSql`
            which is required by `&Decimal: tokio_postgres::types::ToSql`

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `quaint` due to 6 previous errors

quaint version 0.1.13 cargo and rustc version 1.66.1

Thanks in advance.