Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract filter system further to allow more complex nested conditional operations #12

Open
jonahseguin opened this issue Jan 21, 2023 · 1 comment
Assignees

Comments

@jonahseguin
Copy link
Member

Goal is to support more complex queries like so:

db.users.find({
$or: [ { address: { country: "CA" } }, { name: "jonah" } ]
})

which would look something like this:

let filter: Filter = User::filter()
  .any(|f| {
    f.entry(f.address().country().eq("CA".to_string()))
    .entry(f.name().eq("jonah".to_string()))
  }).build();

// OR

let filter: Filter = User::filter()
  .any(|f| vec![
    f.address().country().eq("CA".to_string()), 
    f.name().eq("jonah".to_string()),
    ])
  .build();
@jonahseguin jonahseguin self-assigned this Jan 24, 2023
@jonahseguin
Copy link
Member Author

jonahseguin commented Jan 24, 2023

@bizarre Implemented this in latest commit on jonah/macro branch; see here @ musty/examples/filter.rs

Let me know what you think of the implementation or if any changes should be made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant