Open
Description
I am trying to build a dynamic SQL query language and have a JSON like this for representing where clause
{
"filter": {
_and: [
{ rating: { _gte: 4 } },
{ published_on: { _gte: "2018-01-01" } },
{
_or: [{
type: { _eq: 'Books' },
language: { _eq: "Spanish" }
},
{
type: { _eq: 'Movies' },
language: { _eq: "English" }
}]
}
]
}
}
Idea here is, Get me all Spanish books or English Movies published after 2018 with a rating greater than 4
Schema is something like this
filter: BoolExp
BoolExp: [AndExp] | [OrExp]| [ColumnExp]
{_and: [BoolExp]}
{_or: [BoolExp]}
ColumnExp
=> { field-name: { [Operator]: Value }}
Operator
has values like eq, gt, lt,..
Please note there could be nested conditions like or within an and which is also within another or
I am unsure about how to create typescript classes and configure them. Any help is appreciated.
Thanks