Skip to content

Consider repealing nesting constraint on logical operators #3

@numberoverzero

Description

@numberoverzero

As noted in the readme, this::

{
    "column": "name"
    "operator": "like"
    "value": {
        "operator": "or",
        "value": [
            "Bill",
            "Mary",
            "Steve"
        ]
    }
}

is much more readable than this::

{
    "operator": "or",
    "value": [
        {
            "column": "name",
            "operator": "like",
            "value": "Bill"
        },
        {
            "column": "name",
            "operator": "like",
            "value": "Mary"
        },
        {
            "column": "name",
            "operator": "like",
            "value": "Steve"
        },
    ]
}

By collapsing the redundant information (column and operator) the intent is much more readable.

Concerns while implementing:

  • What's the information propagation limit for values? The above is an easy choice, but what if one of those values wasn't a string, but another node?
  • Can nodes overwrite operator values defined above? What if in the first snipped the user wants to use the like operator for 11 names but then use ilike the operator for "Mary"? Could they make the element a node that overrides operator, or do they have to nest the above in another OR to include the field?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions