(
State(worker_ctx): State<S>,
Path(name_or_identity): Path<SqlParams>,
Query(params): Query<SqlQueryParams>,
Extension(auth): Extension<SpacetimeAuth>,
body: String,
)
| 757 | } |
| 758 | |
| 759 | pub async fn sql<S>( |
| 760 | State(worker_ctx): State<S>, |
| 761 | Path(name_or_identity): Path<SqlParams>, |
| 762 | Query(params): Query<SqlQueryParams>, |
| 763 | Extension(auth): Extension<SpacetimeAuth>, |
| 764 | body: String, |
| 765 | ) -> axum::response::Result<impl IntoResponse> |
| 766 | where |
| 767 | S: NodeDelegate + ControlStateDelegate + Authorization, |
| 768 | { |
| 769 | let caller_identity = auth.claims.identity; |
| 770 | let caller_auth: ConnectionAuthCtx = auth.into(); |
| 771 | let json = sql_direct(worker_ctx, name_or_identity, params, caller_identity, caller_auth, body).await?; |
| 772 | |
| 773 | let total_duration = json.iter().fold(0, |acc, x| acc + x.total_duration_micros); |
| 774 | |
| 775 | Ok(( |
| 776 | TypedHeader(SpacetimeExecutionDurationMicros(Duration::from_micros(total_duration))), |
| 777 | axum::Json(json), |
| 778 | )) |
| 779 | } |
| 780 | |
| 781 | #[derive(Deserialize)] |
| 782 | pub struct DNSParams { |
no test coverage detected