webql 0.1.0

WebQL is a library that allows to get data from multiple resources or JSON and filter the result
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use anyhow::{bail, Context, Result};
use chrono::{DateTime, Utc};
use serde_json::Value;

/// convert [`Value`] string data to [`DateTime<Utc>`]
pub fn parse_to_date_time(v: &Value) -> Result<DateTime<Utc>> {
    match v
        .as_str()
        .with_context(|| format!("could not convert date: {:?} to as_str", v))?
        .parse()
    {
        Ok(dt) => Ok(dt),
        Err(e) => bail!(e),
    }
}