Forwards a collection of Notices to the provided [`WebSocket`].
(
ws: &mut WebSocket,
notices: impl IntoIterator<Item = AdapterNotice>,
)
| 490 | |
| 491 | /// Forwards a collection of Notices to the provided [`WebSocket`]. |
| 492 | async fn forward_notices( |
| 493 | ws: &mut WebSocket, |
| 494 | notices: impl IntoIterator<Item = AdapterNotice>, |
| 495 | ) -> Result<(), Error> { |
| 496 | let ws_notices = notices.into_iter().map(|notice| { |
| 497 | WebSocketResponse::Notice(Notice { |
| 498 | message: notice.to_string(), |
| 499 | code: notice.code().code().to_string(), |
| 500 | severity: notice.severity().as_str().to_lowercase(), |
| 501 | detail: notice.detail(), |
| 502 | hint: notice.hint(), |
| 503 | }) |
| 504 | }); |
| 505 | |
| 506 | for notice in ws_notices { |
| 507 | send_ws_response(ws, notice).await?; |
| 508 | } |
| 509 | |
| 510 | Ok(()) |
| 511 | } |
| 512 | |
| 513 | /// A request to execute SQL over HTTP. |
| 514 | #[derive(Serialize, Deserialize, Debug)] |