Crate ksql

source ·
Expand description

KSQL

Is a JSON data expression lexer, parser, cli and library.

Expressions

Expressions support most mathematical and string expressions see the lexer module for details of the lexer support and rules.

use ksql::parser::{Parser, Value};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>>{
    let src = r#"{"name":"MyCompany", "properties":{"employees": 50}"#.as_bytes();
    let ex = Parser::parse(".properties.employees > 20")?;
    let result = ex.calculate(src)?;
    assert_eq!(Value::Bool(true), result);
    Ok(())
}

Modules

  • KSQL Expression lexer
  • KSQL Expression parser Parser is used to parse an expression for use against JSON data.