The programme runs and an API is served on 127.0.0.1:3000.
error[E0308]: mismatched types
--> src/main.rs:45:25
|
45 | let todos = sqlx::query_as!(
| _________________________^
46 | | Todo,
47 | | "SELECT * FROM todos"
48 | | )
| |_________^ expected `i64`, found `Option<i64>`
|
= note: expected type `i64`
found enum `std::option::Option<i64>`
= note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> src/main.rs:45:25
|
45 | let todos = sqlx::query_as!(
| _________________________^
46 | | Todo,
47 | | "SELECT * FROM todos"
48 | | )
| |_________^ expected `String`, found `Option<String>`
|
= note: expected struct `std::string::String`
found enum `std::option::Option<std::string::String>`
= note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> src/main.rs:45:25
|
45 | let todos = sqlx::query_as!(
| _________________________^
46 | | Todo,
47 | | "SELECT * FROM todos"
48 | | )
| |_________^ expected `bool`, found `Option<bool>`
|
= note: expected type `bool`
found enum `std::option::Option<bool>`
= note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)
help: use `Option::is_some` to test if the `Option` has a value
--> /home/nico/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-0.6.3/src/macros/mod.rs:558:82
|
558| $crate::sqlx_macros::expand_query!(record = $out_struct, source = $query).is_some()
| ++++++++++
error: future cannot be sent between threads safely
--> src/main.rs:22:1
|
22 | #[OpenApi]
| ^^^^^^^^^^ future created by async block is not `Send`
|
note: opaque type is declared here
--> src/main.rs:44:10
|
44 | ) -> TodoResponse {
| ^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
--> src/main.rs:22:1
|
22 | #[OpenApi]
| ^^^^^^^^^^
note: future is not `Send` as it awaits another future which is not `Send`
--> src/main.rs:22:1
|
22 | #[OpenApi]
| ^^^^^^^^^^ await occurs here on type `impl Future<Output = Result<poem_openapi::payload::Json<Vec<Todo>>, poem::Error>>`, which is not `Send`
note: required by a bound in `poem::endpoint::make`
--> /home/nico/.cargo/registry/src/index.crates.io-6f17d22bba15001f/poem-1.3.58/src/endpoint/endpoint.rs:168:31
|
165 | pub fn make<F, Fut, T, R>(f: F) -> impl Endpoint<Output = T>
| ---- required by a bound in this function
...
168 | Fut: Future<Output = R> + Send,
| ^^^^ required by this bound in `make`
= note: this error originates in the attribute macro `OpenApi` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0308`.
error: could not compile `todo-api` (bin "todo-api") due to 4 previous errors