pub trait Selectable {
// Required methods
fn filter(&self) -> Option<String>;
fn limit(&self) -> Option<usize>;
fn offset(&self) -> Option<usize>;
fn order_by(&self) -> Option<String>;
// Provided method
fn statement(&self) -> String { ... }
}
Expand description
Definition of trait Selectable
. This trait outputs filter, limit and offset statement.
Required Methods§
Sourcefn filter(&self) -> Option<String>
fn filter(&self) -> Option<String>
Output filter statement - which will be appended to the WHERE
clause - such as:
field='banana'
: item where the entryfield
is equal to'banana'
;1=0
: return no items;1=1
: return all items;
Return None
if no filtering is requested.
Sourcefn limit(&self) -> Option<usize>
fn limit(&self) -> Option<usize>
Output limit statement - which will be appended to the LIMIT
clause - such as:
10
: returns only 10 entries
Return None
if no limit is requested.