-
Notifications
You must be signed in to change notification settings - Fork 27
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
Some information on filter #18
Comments
ReQL closures can take multiple arguments. We can't reasonably implement all the possibilities using Rust's type system. Combined with the fact that ReQL has so many commands, I decided to generate the commands automatically straight from the ReQL documentation. To make this possible, I made the following design choices:-
The argument that the command takes must implement reql::IntoArg. As you can see from the second error message, we don't implement it for closures as this is not practical. Instead we use the let query =
r.db("test")
.table("test")
.filter(args!(|doc| {
doc.has_fields("test").and(doc.get_field("test").type_of().eq("NUMBER"))
}))
.changes() |
I see, that makes a lot more sense now, thank you! I've updated the example code to reflect the filtered change. |
My pleasure :)
Awesome! Let me take a look. Thanks. |
So I'm trying to write a simple filter to expand the changelog example so that it notes only changes which match our TestItem implementation, however I can't seem to get any filters working:
Gives me:
Any advice on the filter implementation would be appreciated, I'm rather new to Rust at this point.
The text was updated successfully, but these errors were encountered: