woylie/flop

Filter groups AND/OR

Closed this issue · 2 comments

Hi, colleagues. I am using flop for a while and just want to thank you for saving so much of my time with building complex query logic.

Did you ever consider filter groups, like this example:

%{filters: [
  {:or,
    [
      {:and, [
        %{field: :status, op: :==, value: "done"},
        %{field: :due_date, op: :==, value: "2024-01-14"}
      ]},
      {:and, [
        %{field: :status, op: :==, value: "in_progress"},
        %{field: :due_date, op: :==, value: "2024-01-14"}
      ]}
    ]
  }
]}

Here I assume to query all tasks with status done yesterday and in_progress today.

I understand it's a tricky part, but we can start with a small one, and maybe I can contribute into your awesome library?

Hi 👋

Yes, this has come up before:

One important requirement is that the format needs to be serializable as JSON, and it should be possible to reflect it in a filter form. There are some previous considerations about the format: #415 (reply in thread).

I'm currently not planning on implementing this, since there are some other important things I want to get done first. If you want to contribute, though, I'm open.

@woylie Thanks. Let's move then into discussion #415