when I try to follow the example code for using Rocket with SQLx 0.6.0 and rocket_db_pools
\nIt compiles when using SQLx 0.5.13 so I'm guessing some traits need to be implemented?
\nOr do I have to pass the connection pool in another way? Right now I'm doing it like this:
#[get(\"/tags\")]\npub async fn fetch(\n\tmut db: Connection<Db>\n) -> Result<Json<Vec<Tag>>, (Status, Json<ApiError>)> {\n\tsqlx::query_as!(Tag, \"SELECT id, label, color FROM tag ORDER BY id\")\n\t\t.fetch_all(&mut *db)\n\t\t.await\n\t\t.map(|tag| Json(tag))\n\t\t.map_err(|e| {\n\t\t\tApiError::server_error(\n\t\t\t\tStatus::InternalServerError, \n\t\t\t\t&e.to_string()\n\t\t\t)\n\t\t})\n}\nJust so it's absolutely clear what worked: .fetch_all(&mut *db) became .fetch_all(&mut **db).
-
|
I get the error when I try to follow the example code for using Rocket with SQLx 0.6.0 and rocket_db_pools |
Beta Was this translation helpful? Give feedback.
-
|
I also have same problem. Did you fix it? |
Beta Was this translation helpful? Give feedback.
-
|
Do you have |
Beta Was this translation helpful? Give feedback.
-
|
I already solved it using dereference. |
Beta Was this translation helpful? Give feedback.
-
|
Just so it's absolutely clear what worked: |
Beta Was this translation helpful? Give feedback.
Just so it's absolutely clear what worked:
.fetch_all(&mut *db)became.fetch_all(&mut **db).