/db/query # Errors query fails # Panics cannot connect to the database
(db: &Database, body: &MySqlQuery)
| 35 | /// # Panics |
| 36 | /// * cannot connect to the database |
| 37 | pub fn query_db(db: &Database, body: &MySqlQuery) -> Result<String, diesel::result::Error> { |
| 38 | let q = format!("SELECT json_agg(q) as json FROM ({}) q;", body.query); |
| 39 | let mut db = db.get_connection().unwrap(); |
| 40 | |
| 41 | Ok(sql_query(q.as_str()) |
| 42 | .get_result::<MyQueryResult>(&mut db)? |
| 43 | .json) |
| 44 | } |
| 45 | |
| 46 | /// /db/is-connected |
| 47 | #[must_use] |
nothing calls this directly
no test coverage detected