derive_sql/traits/
filter.rs

1use super::*;
2
3/// Trait to be implemented for filtering. Returns the contents of a `WHERE` clause.
4pub trait FlavoredFilter {
5  fn filter<C, R>(&self, conn: &C) -> Result<String>
6  where C: Connection<R>,
7        R: Row;
8}
9
10/// Trait to be implemented for filtering. Returns the contents of a `WHERE` clause.
11pub trait Filter {
12  fn filter(&self) -> String;
13}
14
15impl<F> FlavoredFilter for F
16where F: Filter
17{
18  fn filter<C, R>(&self, _conn: &C) -> Result<String>
19  where C: Connection<R>,
20        R: Row,
21  {
22    Ok(Filter::filter(self))
23  }
24}