STATUS Still experimental. In version 0.y.z, breaking changes will occur in .y, and additions/fixes in .z. Once it reaches x.y.z, it will follow SemVer best practices.

tl;dr - modql is a normalized declarative model and store agnostic query language.

changelog

Overview

One modql representation is joql, which is the JSON serialization of this model.

modql has the joql deserializer to build the filter, and provides the raw construct to make them directly from Rust types.

In short, modql allows to express of a store model-specific filter and include rules which can be implemented for various store. For example, it can express:

Json example

The JSON/joql representation of this would be something like: ts { $filters: { "title": {$containsIn: ["hello", "welcome"]}, "done": true, // equivalent: "done": {$eq: true} }, $includes: { // not implemented yet "id": true, "title": true, "done": true, } }

Rust types

On the Rust side, this can be expressed like this:

```rs use modql::filter::{FilterGroups, FilterNode, OpValString};

fn main() -> anyhow::Result<()> { println!("->> hello! {}", 111);

let filter_nodes: Vec<FilterNode> = vec![
    (
        "title",
        OpValString::ContainsIn(vec!["Hello".to_string(), "welcome".to_string()]),
    )
        .into(),
    ("done", true).into(),
];
let filter_groups: FilterGroups = filter_nodes.into();

println!("filter_groups:\n{filter_groups:#?}");

Ok(())

} ```

Then, a Model or Store layer can get the filter_groups, and serialize to their DSL (i.e. SQL for database)

The Filter structure is as followed:

FilterNodes macro

A convenient FilterNodes implements the various functions to get the into FilterNode FilterGroups

```rs use modql::filter::{FilterGroups, FilterNodes, OpValBool, OpValString, OpValsBool, OpValsString};

[derive(FilterNodes)]

struct MyFilter { done: Option, name: Option, }

let filter = MyFilter { done: Some(OpValBool::Eq(true).into()), name: Some( vec![ OpValString::Contains("Hello".tostring()), OpValString::Contains("welcome".tostring()), ] .into(), ), };

let filter_groups: FilterGroups = filter.into();

println!("filtergroups:\n{filtergroups:#?}"); ```