Skip to content

Instantly share code, notes, and snippets.

View connor-davis's full-sized avatar
💡
Learning

Connor Davis connor-davis

💡
Learning
View GitHub Profile
@connor-davis
connor-davis / json_to_sql.rs
Last active August 14, 2024 09:36
Takes a specifically defined json object and converts it to a sql query.
use anyhow::Error;
use serde_json::{json, Value};
use crate::utils::merge_json;
pub async fn report_to_sql(report: Value) -> Result<String, Error> {
let table = report["table"].as_object();
if table.is_none() {
return Err(Error::msg("Table not found."));