jeremychone / rust-sqlb Goto Github PK
View Code? Open in Web Editor NEWSimple and expressive SQL Builder for Rust (Database Executor/Driver Independent).
License: Apache License 2.0
Simple and expressive SQL Builder for Rust (Database Executor/Driver Independent).
License: Apache License 2.0
Hi @jeremychone, So am trying the latest version of sqlb
which is 0.4
but encountering a few errors.
Dependencies in Cargo.toml
:
sqlx = "0.7.2"
sqlb = { version = "0.4.0", features = ["chrono-support"] }
chrono = "0.4.31"
Errors I get when compiling the project:
error[E0277]: the trait bound `NaiveDateTime: Encode<'_, Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:26:40
|
26 | let query = query.bind(self.clone());
| ---- ^^^^^^^^^^^^ the trait `Encode<'_, Postgres>` is not implemented for `NaiveDateTime`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Encode<'q, DB>`:
<bool as Encode<'q, sqlx::Any>>
<bool as Encode<'_, Postgres>>
<i8 as Encode<'_, Postgres>>
<i16 as Encode<'q, sqlx::Any>>
<i16 as Encode<'_, Postgres>>
<i32 as Encode<'q, sqlx::Any>>
<i32 as Encode<'_, Postgres>>
<i64 as Encode<'q, sqlx::Any>>
and 39 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:32
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveDateTime: Type<Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:26:40
|
26 | let query = query.bind(self.clone());
| ---- ^^^^^^^^^^^^ the trait `Type<Postgres>` is not implemented for `NaiveDateTime`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Type<DB>`:
<bool as Type<Postgres>>
<bool as Type<sqlx::Any>>
<i8 as Type<Postgres>>
<i16 as Type<Postgres>>
<i16 as Type<sqlx::Any>>
<i32 as Type<Postgres>>
<i32 as Type<sqlx::Any>>
<i64 as Type<Postgres>>
and 49 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:49
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveDateTime: Encode<'_, Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:33:40
|
33 | let query = query.bind(<$t>::clone(self));
| ---- ^^^^^^^^^^^^^^^^^ the trait `Encode<'_, Postgres>` is not implemented for `NaiveDateTime`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Encode<'q, DB>`:
<bool as Encode<'q, sqlx::Any>>
<bool as Encode<'_, Postgres>>
<i8 as Encode<'_, Postgres>>
<i16 as Encode<'q, sqlx::Any>>
<i16 as Encode<'_, Postgres>>
<i32 as Encode<'q, sqlx::Any>>
<i32 as Encode<'_, Postgres>>
<i64 as Encode<'q, sqlx::Any>>
and 39 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:32
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveDateTime: Type<Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:33:40
|
33 | let query = query.bind(<$t>::clone(self));
| ---- ^^^^^^^^^^^^^^^^^ the trait `Type<Postgres>` is not implemented for `NaiveDateTime`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Type<DB>`:
<bool as Type<Postgres>>
<bool as Type<sqlx::Any>>
<i8 as Type<Postgres>>
<i16 as Type<Postgres>>
<i16 as Type<sqlx::Any>>
<i32 as Type<Postgres>>
<i32 as Type<sqlx::Any>>
<i64 as Type<Postgres>>
and 49 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:49
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveDate: Encode<'_, Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:26:40
|
26 | let query = query.bind(self.clone());
| ---- ^^^^^^^^^^^^ the trait `Encode<'_, Postgres>` is not implemented for `NaiveDate`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Encode<'q, DB>`:
<bool as Encode<'q, sqlx::Any>>
<bool as Encode<'_, Postgres>>
<i8 as Encode<'_, Postgres>>
<i16 as Encode<'q, sqlx::Any>>
<i16 as Encode<'_, Postgres>>
<i32 as Encode<'q, sqlx::Any>>
<i32 as Encode<'_, Postgres>>
<i64 as Encode<'q, sqlx::Any>>
and 39 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:32
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveDate: Type<Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:26:40
|
26 | let query = query.bind(self.clone());
| ---- ^^^^^^^^^^^^ the trait `Type<Postgres>` is not implemented for `NaiveDate`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Type<DB>`:
<bool as Type<Postgres>>
<bool as Type<sqlx::Any>>
<i8 as Type<Postgres>>
<i16 as Type<Postgres>>
<i16 as Type<sqlx::Any>>
<i32 as Type<Postgres>>
<i32 as Type<sqlx::Any>>
<i64 as Type<Postgres>>
and 49 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:49
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveDate: Encode<'_, Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:33:40
|
33 | let query = query.bind(<$t>::clone(self));
| ---- ^^^^^^^^^^^^^^^^^ the trait `Encode<'_, Postgres>` is not implemented for `NaiveDate`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Encode<'q, DB>`:
<bool as Encode<'q, sqlx::Any>>
<bool as Encode<'_, Postgres>>
<i8 as Encode<'_, Postgres>>
<i16 as Encode<'q, sqlx::Any>>
<i16 as Encode<'_, Postgres>>
<i32 as Encode<'q, sqlx::Any>>
<i32 as Encode<'_, Postgres>>
<i64 as Encode<'q, sqlx::Any>>
and 39 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:32
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveDate: Type<Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:33:40
|
33 | let query = query.bind(<$t>::clone(self));
| ---- ^^^^^^^^^^^^^^^^^ the trait `Type<Postgres>` is not implemented for `NaiveDate`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Type<DB>`:
<bool as Type<Postgres>>
<bool as Type<sqlx::Any>>
<i8 as Type<Postgres>>
<i16 as Type<Postgres>>
<i16 as Type<sqlx::Any>>
<i32 as Type<Postgres>>
<i32 as Type<sqlx::Any>>
<i64 as Type<Postgres>>
and 49 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:49
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveTime: Encode<'_, Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:26:40
|
26 | let query = query.bind(self.clone());
| ---- ^^^^^^^^^^^^ the trait `Encode<'_, Postgres>` is not implemented for `NaiveTime`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Encode<'q, DB>`:
<bool as Encode<'q, sqlx::Any>>
<bool as Encode<'_, Postgres>>
<i8 as Encode<'_, Postgres>>
<i16 as Encode<'q, sqlx::Any>>
<i16 as Encode<'_, Postgres>>
<i32 as Encode<'q, sqlx::Any>>
<i32 as Encode<'_, Postgres>>
<i64 as Encode<'q, sqlx::Any>>
and 39 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:32
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveTime: Type<Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:26:40
|
26 | let query = query.bind(self.clone());
| ---- ^^^^^^^^^^^^ the trait `Type<Postgres>` is not implemented for `NaiveTime`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Type<DB>`:
<bool as Type<Postgres>>
<bool as Type<sqlx::Any>>
<i8 as Type<Postgres>>
<i16 as Type<Postgres>>
<i16 as Type<sqlx::Any>>
<i32 as Type<Postgres>>
<i32 as Type<sqlx::Any>>
<i64 as Type<Postgres>>
and 49 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:49
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveTime: Encode<'_, Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:33:40
|
33 | let query = query.bind(<$t>::clone(self));
| ---- ^^^^^^^^^^^^^^^^^ the trait `Encode<'_, Postgres>` is not implemented for `NaiveTime`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Encode<'q, DB>`:
<bool as Encode<'q, sqlx::Any>>
<bool as Encode<'_, Postgres>>
<i8 as Encode<'_, Postgres>>
<i16 as Encode<'q, sqlx::Any>>
<i16 as Encode<'_, Postgres>>
<i32 as Encode<'q, sqlx::Any>>
<i32 as Encode<'_, Postgres>>
<i64 as Encode<'q, sqlx::Any>>
and 39 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:32
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `NaiveTime: Type<Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:33:40
|
33 | let query = query.bind(<$t>::clone(self));
| ---- ^^^^^^^^^^^^^^^^^ the trait `Type<Postgres>` is not implemented for `NaiveTime`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Type<DB>`:
<bool as Type<Postgres>>
<bool as Type<sqlx::Any>>
<i8 as Type<Postgres>>
<i16 as Type<Postgres>>
<i16 as Type<sqlx::Any>>
<i32 as Type<Postgres>>
<i32 as Type<sqlx::Any>>
<i64 as Type<Postgres>>
and 49 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:49
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `chrono::DateTime<Utc>: Encode<'_, Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:26:40
|
26 | let query = query.bind(self.clone());
| ---- ^^^^^^^^^^^^ the trait `Encode<'_, Postgres>` is not implemented for `chrono::DateTime<Utc>`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Encode<'q, DB>`:
<bool as Encode<'q, sqlx::Any>>
<bool as Encode<'_, Postgres>>
<i8 as Encode<'_, Postgres>>
<i16 as Encode<'q, sqlx::Any>>
<i16 as Encode<'_, Postgres>>
<i32 as Encode<'q, sqlx::Any>>
<i32 as Encode<'_, Postgres>>
<i64 as Encode<'q, sqlx::Any>>
and 39 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:32
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `chrono::DateTime<Utc>: Type<Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:26:40
|
26 | let query = query.bind(self.clone());
| ---- ^^^^^^^^^^^^ the trait `Type<Postgres>` is not implemented for `chrono::DateTime<Utc>`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Type<DB>`:
<bool as Type<Postgres>>
<bool as Type<sqlx::Any>>
<i8 as Type<Postgres>>
<i16 as Type<Postgres>>
<i16 as Type<sqlx::Any>>
<i32 as Type<Postgres>>
<i32 as Type<sqlx::Any>>
<i64 as Type<Postgres>>
and 49 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:49
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `chrono::DateTime<Utc>: Encode<'_, Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:33:40
|
33 | let query = query.bind(<$t>::clone(self));
| ---- ^^^^^^^^^^^^^^^^^ the trait `Encode<'_, Postgres>` is not implemented for `chrono::DateTime<Utc>`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Encode<'q, DB>`:
<bool as Encode<'q, sqlx::Any>>
<bool as Encode<'_, Postgres>>
<i8 as Encode<'_, Postgres>>
<i16 as Encode<'q, sqlx::Any>>
<i16 as Encode<'_, Postgres>>
<i32 as Encode<'q, sqlx::Any>>
<i32 as Encode<'_, Postgres>>
<i64 as Encode<'q, sqlx::Any>>
and 39 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:32
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `chrono::DateTime<Utc>: Type<Postgres>` is not satisfied
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlb-0.4.0\src\val.rs:33:40
|
33 | let query = query.bind(<$t>::clone(self));
| ---- ^^^^^^^^^^^^^^^^^ the trait `Type<Postgres>` is not implemented for `chrono::DateTime<Utc>`
| |
| required by a bound introduced by this call
...
96 | bindable!(NaiveDateTime, NaiveDate, NaiveTime, DateTime<Utc>);
| ------------------------------------------------------------- in this macro invocation
|
= help: the following other types implement trait `Type<DB>`:
<bool as Type<Postgres>>
<bool as Type<sqlx::Any>>
<i8 as Type<Postgres>>
<i16 as Type<Postgres>>
<i16 as Type<sqlx::Any>>
<i32 as Type<Postgres>>
<i32 as Type<sqlx::Any>>
<i64 as Type<Postgres>>
and 49 others
note: required by a bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
--> C:\Users\Adi\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sqlx-core-0.7.2\src\query.rs:79:49
|
79 | pub fn bind<T: 'q + Send + Encode<'q, DB> + Type<DB>>(mut self, value: T) -> Self {
| ^^^^^^^^ required by this bound in `Query::<'q, DB, <DB as HasArguments<'q>>::Arguments>::bind`
= note: this error originates in the macro `bindable` (in Nightly builds, run with -Z macro-backtrace for more info)
My rustup toolchain is stable-x86_64-pc-windows-msvc
and version of rustc is 1.72.1
.
There is no way to do select().columns(&["count(*)"])
as sqlb will wrap everything in double quote.
The simplest to support this use case is to assume that if the column name has a (
it is not a simple column name but more of a function call.
Later we can add more special characters if needed.
Hello Jeremy, I've been following along with your Rust Web App TodoMVC tutorials for implementing my own application. It's been a fantastic help with what I'm trying to accomplish. However, when working with sqlb I seem to be running into an issue with the bindable! macro. I've looked over your source code for the YouTube series as well as the sqlb source and I can't seem to figure out why this is returning an error. Any help is greatly appreciated and if you need more of my source code please let me know.
Thank you,
Justin Leahy
Error:
error[E0277]: the trait bound `Option<TransactionTypes>: SqlxBindable` is not satisfied
--> src/model/portfolio.rs:49:10
|
49 | #[derive(sqlb::Fields, Clone)]
| ^^^^^^^^^^^^ the trait `SqlxBindable` is not implemented for `Option<TransactionTypes>`
|
= help: the following other types implement trait `SqlxBindable`:
Option<&std::string::String>
Option<&str>
Option<OffsetDateTime>
Option<Uuid>
Option<bool>
Option<f32>
Option<f64>
Option<i16>
and 4 others
= note: required for `Field<'_>` to implement `From<(&str, Option<TransactionTypes>)>`
= note: required for `(&str, Option<TransactionTypes>)` to implement `Into<Field<'_>>`
= note: this error originates in the derive macro `sqlb::Fields` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
Code:
#[derive(sqlb::Fields, Clone)]
pub struct TransactionPatch {
pub account_id: Option<i32>,
pub stock_id: Option<i32>,
pub date: Option<String>,
pub shares_whole: Option<i64>,
pub shares_decimal: Option<i64>,
pub shares_decimal_exponent: Option<i64>,
pub price_dollars: Option<i64>,
pub price_cents: Option<i64>,
pub transaction_type: Option<TransactionTypes>
}
#[derive(sqlx::Type, Debug, Clone, PartialEq, Eq)]
#[sqlx(type_name = "transactiontypes")]
#[sqlx(rename_all = "lowercase")]
pub enum TransactionTypes {
Buy,
Sell,
DRIP,
}
sqlb::bindable!(TransactionTypes);
As mentioned in #6, when a type T
implement SqlxBindable
there is not SqlxBindable
blanket implementation for Option<T>
make it impossible to have Option<T>
for custom types.
Refactor sqlb code to have SqlxBindable
blanket implementation for Option<T> where T: SqlxBindable
NOTES:
Clone
and Send
and be a supported sqlx
type.SqlxBindable
interface, which should not impact most code (see SqlxBindable
signature if compile error)Right now, there is no way to point to a schema. See comment on #6
The main issue is that sqlb "
surround table names without anticipating eventual schema name.
If "." in a table name, each parts should be "
surrounded.
So should support the following:
let todos: Vec<Todo> = sqlb::select()
.table("public.todo")
.columns(&["id", "todo.title", "public.todo.description"])
.fetch_all(&db_pool)
.await?;
...
#[derive(Debug, sqlx::FromRow, Fields)]
pub struct Todo {
pub id: i64,
pub title: String,
#[sqlx(rename = "description")]
#[field(name = "description")]
pub desc: Option<String>,
}
Hi @jeremychone, So am trying the latest version of rust-sqlb which is 0.3.7
but encountring few errors here.
For the Fields if I have Option won't work and gives error.
#[derive(sqlb::Fields, Clone)]
pub struct EmployeeCompanyAssociationPatch {
pub employee_email: Option<String>,
pub name: Option<String>,
pub status: Option<EmployeeCompanyAssociationStatus>,
}
Compiler Error for sqlb::Fields
the trait bound `EmployeeCompanyAssociationStatus: sqlx_core::types::Type<sqlx_core::postgres::database::Postgres>` is not
satisfied [E0277] Help: the following other types implement trait `sqlx_core::types::Type<DB>`: <&T as
sqlx_core::types::Type<DB>> <() as sqlx_core::types::Type<sqlx_core::postgres::database::Postgres>> <(T1, T2) as
sqlx_core::types::Type<sqlx_core::postgres::database::Postgres>> <(T1, T2, T3) as
sqlx_core::types::Type<sqlx_core::postgres::database::Postgres>> <(T1, T2, T3, T4) as
sqlx_core::types::Type<sqlx_core::postgres::database::Postgres>> <(T1, T2, T3, T4, T5) as
sqlx_core::types::Type<sqlx_core::postgres::database::Postgres>> <(T1, T2, T3, T4, T5, T6) as
sqlx_core::types::Type<sqlx_core::postgres::database::Postgres>> <(T1, T2, T3, T4, T5, T6, T7) as
sqlx_core::types::Type<sqlx_core::postgres::database::Postgres>> and 40 others Note: required for
`std::option::Option<EmployeeCompanyAssociationStatus>` to implement `SqlxBindable` Note: required for `sqlb::Field<'_>` to
implement `From<(&str, std::option::Option<EmployeeCompanyAssociationStatus>)>` Note: required for `(&str,
std::option::Option<EmployeeCompanyAssociationStatus>)` to implement `Into<sqlb::Field<'_>>`
the trait bound `for<'r> EmployeeCompanyAssociationStatus: sqlx_core::encode::Encode<'r,
sqlx_core::postgres::database::Postgres>` is not satisfied [E0277] Help: the following other types implement trait
`sqlx_core::encode::Encode<'q, DB>`: <&T as sqlx_core::encode::Encode<'q, DB>> <&[T] as sqlx_core::encode::Encode<'q,
sqlx_core::postgres::database::Postgres>> <&[u8] as sqlx_core::encode::Encode<'_, sqlx_core::postgres::database::Postgres>>
<&str as sqlx_core::encode::Encode<'_, sqlx_core::postgres::database::Postgres>> <Cow<'_, str> as sqlx_core::encode::Encode<'_,
sqlx_core::postgres::database::Postgres>> <JsonValue as sqlx_core::encode::Encode<'q, DB>> <Uuid as
sqlx_core::encode::Encode<'_, sqlx_core::postgres::database::Postgres>> <Vec<T> as sqlx_core::encode::Encode<'q,
sqlx_core::postgres::database::Postgres>> and 26 others Note: required for
`std::option::Option<EmployeeCompanyAssociationStatus>` to implement `SqlxBindable` Note: required for `sqlb::Field<'_>` to
implement `From<(&str, std::option::Option<EmployeeCompanyAssociationStatus>)>` Note: required for `(&str,
std::option::Option<EmployeeCompanyAssociationStatus>)` to implement `Into<sqlb::Field<'_>>`
Also below is the bindable not working as well, am I still need to do it this way? or is it changed now?
#[derive(sqlx::Type, Debug, Clone, PartialEq, Eq)]
#[sqlx(type_name = "status")]
pub enum EmployeeCompanyAssociationStatus {
Active,
Terminated,
}
sqlb::bindable!(EmployeeCompanyAssociationStatus);
method `bind_query` has an incompatible type for trait [E0053] Note: expected signature `fn(&'q
EmployeeCompanyAssociationStatus, sqlx_core::query::Query<'q, sqlx_core::postgres::database::Postgres,
sqlx_core::postgres::arguments::PgArguments>) -> sqlx_core::query::Query<'q, sqlx_core::postgres::database::Postgres,
sqlx_core::postgres::arguments::PgArguments>` found signature `fn(&EmployeeCompanyAssociationStatus,
sqlx::query::Query<'_, Postgres, PgArguments>) -> sqlx::query::Query<'_, Postgres, PgArguments>` Help: change the parameter
type to match the trait
I noticed that the sqlb crate has the following features enabled for sqlx:
sqlx = { version = "0.6", features = ["runtime-tokio-rustls", "postgres", "time", "uuid"] }
According to my understanding, sqlx
does not support having conflicting runtime features specified. Specifically, the runtime-tokio-rustls
feature conflicts with other runtime features.
I believe it would be beneficial to mention this in the sqlb
crate's README file to avoid potential issues. It could be something like:
Note: sqlb has "runtime-tokio-rustls" enabled by the sqlx crate. Do not enable a conflicting runtime feature when adding sqlx to your project.
Would it be appropriate to open a PR adding this note to the README or documentation to help users have a smoother experience when using sqlb with sqlx?
The sqlb select
builder is missing .limit(i64)
and .offset(i64)
Implement .limit(i64)
and .offset(i64)
on the SelectSqlBuilder
Mentioned in (#1)
code:
let sb = sqlb::select()
.table("test")
.columns(&["count(*)"]);
println!("{}", sb.sql());
console:
SELECT "count(*)" FROM "task"
this sql ERROR: column "count(id)" does not exist
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.