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

how to add filter dynamic? #381

Closed
Matrix-Zhang opened this Issue Jul 20, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@Matrix-Zhang

Matrix-Zhang commented Jul 20, 2016

i want to select rows with much filters.

how to write the code ? because of the rust static type system, i don't know the right type of the filter

like posts.eq(1).or(posts.between(5..8))

@sgrif

This comment has been minimized.

Member

sgrif commented Jul 25, 2016

Can you give the full code that you're trying to write? Is posts an integer column?

@Matrix-Zhang

This comment has been minimized.

Matrix-Zhang commented Jul 26, 2016

posts is integer, the sever will recive the user input as filter, su as "1,2,5-8"
so, i need build the filter from the user's input

@sgrif

This comment has been minimized.

Member

sgrif commented Aug 1, 2016

http://docs.diesel.rs/diesel/prelude/trait.BoxedDsl.html will help you dynamically build the query. As for parsing the string, that's not something Diesel can help with.

@sgrif sgrif closed this Aug 1, 2016

@Gisleburt

This comment has been minimized.

Gisleburt commented Jul 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment