pub enum RelValue<'a> {
Row(RowRef<'a>),
Projection(ProductValue),
ProjRef(&'a ProductValue),
}Expand description
RelValue represents either a reference to a row in a table, a reference to an inserted row, or an ephemeral row constructed during query execution.
A RelValue is the type generated/consumed by queries.
Variants§
Row(RowRef<'a>)
A reference to a row in a table.
Projection(ProductValue)
An ephemeral row made during query execution.
ProjRef(&'a ProductValue)
A row coming directly from a collected update.
This is really a row in a table, and not an actual projection.
However, for (lifetime) reasons, we cannot (yet) keep it as a RowRef<'_>
and must convert that into a ProductValue.
Implementations§
Source§impl<'a> RelValue<'a>
impl<'a> RelValue<'a>
Sourcepub fn into_product_value(self) -> ProductValue
pub fn into_product_value(self) -> ProductValue
Converts self into a ProductValue
either by reading a value from a table,
cloning the reference to a ProductValue,
or consuming the owned product.
Sourcepub fn into_product_value_cow(self) -> Cow<'a, ProductValue>
pub fn into_product_value_cow(self) -> Cow<'a, ProductValue>
Converts self into a Cow<'a, ProductValue>
either by reading a value from a table,
passing the reference to a ProductValue,
or consuming the owned product.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Computes the number of columns in this value.
Sourcepub fn extend(self, other: RelValue<'a>) -> RelValue<'a>
pub fn extend(self, other: RelValue<'a>) -> RelValue<'a>
Extends self with the columns in other.
This will always cause RowRef<'_>s to be read out into ProductValues.
Sourcepub fn read_column(&self, col: usize) -> Option<Cow<'_, AlgebraicValue>>
pub fn read_column(&self, col: usize) -> Option<Cow<'_, AlgebraicValue>>
Read the column at index col.
Use read_or_take_column instead if you have ownership of self.
Sourcepub fn get(&'a self, col: ColExprRef<'a>) -> Cow<'a, AlgebraicValue>
pub fn get(&'a self, col: ColExprRef<'a>) -> Cow<'a, AlgebraicValue>
Returns a column either at the index specified in col,
or the column is the value that col holds.
Panics if, for ColExprRef::Col(col), the col is out of bounds of self.
Sourcepub fn read_or_take_column(&mut self, col: usize) -> Option<AlgebraicValue>
pub fn read_or_take_column(&mut self, col: usize) -> Option<AlgebraicValue>
Reads or takes the column at col.
Calling this method consumes the column at col for a RelValue::Projection,
so it should not be called again for the same input.
Panics if col is out of bounds of self.
Sourcepub fn project_owned(self, cols: &[ColExpr]) -> ProductValue
pub fn project_owned(self, cols: &[ColExpr]) -> ProductValue
Turns cols into a product
where a value in cols is taken directly from it and indices are taken from self.
Panics on an index that is out of bounds of self.
Trait Implementations§
Source§impl ToBsatn for RelValue<'_>
impl ToBsatn for RelValue<'_>
Source§fn to_bsatn_vec(&self) -> Result<Vec<u8>, BsatnError>
fn to_bsatn_vec(&self) -> Result<Vec<u8>, BsatnError>
self into a freshly-allocated Vec<u8>.Source§fn to_bsatn_extend(&self, buf: &mut Vec<u8>) -> Result<(), BsatnError>
fn to_bsatn_extend(&self, buf: &mut Vec<u8>) -> Result<(), BsatnError>
self into buf,
pushing self’s bytes onto the end of buf, similar to Vec::extend.impl Eq for RelValue<'_>
Auto Trait Implementations§
impl<'a> Freeze for RelValue<'a>
impl<'a> !RefUnwindSafe for RelValue<'a>
impl<'a> Send for RelValue<'a>
impl<'a> Sync for RelValue<'a>
impl<'a> Unpin for RelValue<'a>
impl<'a> !UnwindSafe for RelValue<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Satn for T
impl<T> Satn for T
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
f.Source§fn fmt_psql(
&self,
f: &mut Formatter<'_>,
ty: &PsqlType<'_>,
) -> Result<(), Error>
fn fmt_psql( &self, f: &mut Formatter<'_>, ty: &PsqlType<'_>, ) -> Result<(), Error>
f.Source§fn to_satn(&self) -> String
fn to_satn(&self) -> String
String.Source§fn to_satn_pretty(&self) -> String
fn to_satn_pretty(&self) -> String
String.