pub struct Select<T, E>where
T: Tuple,
E: Expression<T>,{ /* private fields */ }
Expand description
Selects tuples of the underlying sub-expression according to a given predicate.
Example:
use codd::{Database, expression::Select};
let mut db = Database::new();
let fruit = db.add_relation::<String>("Fruit").unwrap();
db.insert(&fruit, vec!["Apple".to_string(), "BANANA".to_string(), "cherry".to_string()].into());
let select = Select::new(
&fruit,
|t| t.contains('A'), // select predicate
);
assert_eq!(vec!["Apple", "BANANA"], db.evaluate(&select).unwrap().into_tuples());
Implementations§
Source§impl<T, E> Select<T, E>where
T: Tuple,
E: Expression<T>,
impl<T, E> Select<T, E>where
T: Tuple,
E: Expression<T>,
Sourcepub fn new<I, P>(expression: I, predicate: P) -> Self
pub fn new<I, P>(expression: I, predicate: P) -> Self
Creates a new Select
expression over expression
according to the predicate
closure.
Sourcepub fn expression(&self) -> &E
pub fn expression(&self) -> &E
Returns a reference to the underlying sub-expression.
Trait Implementations§
Source§impl<T, E> Expression<T> for Select<T, E>where
T: Tuple,
E: Expression<T>,
impl<T, E> Expression<T> for Select<T, E>where
T: Tuple,
E: Expression<T>,
Auto Trait Implementations§
impl<T, E> Freeze for Select<T, E>where
E: Freeze,
impl<T, E> !RefUnwindSafe for Select<T, E>
impl<T, E> !Send for Select<T, E>
impl<T, E> !Sync for Select<T, E>
impl<T, E> Unpin for Select<T, E>where
E: Unpin,
impl<T, E> !UnwindSafe for Select<T, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, E> IntoExpression<T, E> for Ewhere
T: Tuple,
E: Expression<T>,
impl<T, E> IntoExpression<T, E> for Ewhere
T: Tuple,
E: Expression<T>,
Source§fn into_expression(self) -> E
fn into_expression(self) -> E
Consumes the receiver and returns an expression.