pub struct DynamicRow<I> { /* private fields */ }
Expand description

A dynamically sized container that allows to receive a not at compile time known number of columns from the database

Implementations§

source§

impl<I> DynamicRow<I>

source

pub fn get(&self, index: usize) -> Option<&I>

Get the field value at the provided row index

Returns None if the index is outside the bounds of the row

source

pub fn len(&self) -> usize

Get the number of fields in the current row

source

pub fn is_empty(&self) -> bool

Check if the current row is empty

source

pub fn from_row<'a, DB>(row: &impl Row<'a, DB>) -> Result<Self>where DB: Backend, I: FromSql<Any, DB>,

Create a new dynamic row from an existing database row

This function is mostly useful for third party backends adding support for diesel_dynamic_schema

source§

impl<I> DynamicRow<NamedField<I>>

source

pub fn get_by_name<S: AsRef<str>>(&self, name: S) -> Option<&I>

Get the field value by the provided field name

Returns None if the field with the specified name is not found. If there are multiple fields with the same name, the behaviour of this function is unspecified.

source§

impl<I> DynamicRow<NamedField<Option<I>>>

source

pub fn from_nullable_row<'a, DB>(row: &impl Row<'a, DB>) -> Result<Self>where DB: Backend, I: FromSql<Any, DB>,

Create a new dynamic row instance with corresponding field information from the given database row

This function is mostly useful for third party backends adding support for diesel_dynamic_schema

Trait Implementations§

source§

impl<I: Debug> Debug for DynamicRow<I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I> FromIterator<I> for DynamicRow<I>

source§

fn from_iter<T>(iter: T) -> Selfwhere T: IntoIterator<Item = I>,

Creates a value from an iterator. Read more
source§

impl<'a, I> Index<&'a String> for DynamicRow<NamedField<I>>

§

type Output = I

The returned type after indexing.
source§

fn index(&self, field_name: &'a String) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<'a, I> Index<&'a str> for DynamicRow<NamedField<I>>

§

type Output = I

The returned type after indexing.
source§

fn index(&self, field_name: &'a str) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<I> Index<String> for DynamicRow<NamedField<I>>

§

type Output = I

The returned type after indexing.
source§

fn index(&self, field_name: String) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<I> Index<usize> for DynamicRow<I>

§

type Output = I

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<'a, V> IntoIterator for &'a DynamicRow<V>

§

type Item = &'a V

The type of the elements being iterated over.
§

type IntoIter = <&'a Vec<V, Global> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<V> IntoIterator for DynamicRow<V>

§

type Item = V

The type of the elements being iterated over.
§

type IntoIter = <Vec<V, Global> as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<I, DB> QueryableByName<DB> for DynamicRow<NamedField<I>>where DB: Backend, I: FromSql<Any, DB>,

source§

fn build<'a>(row: &impl NamedRow<'a, DB>) -> Result<Self>

Construct an instance of Self from the database row
source§

impl<I, DB> QueryableByName<DB> for DynamicRow<Option<I>>where DB: Backend, I: FromSql<Any, DB>,

source§

fn build<'a>(row: &impl NamedRow<'a, DB>) -> Result<Self>

Construct an instance of Self from the database row

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for DynamicRow<I>where I: RefUnwindSafe,

§

impl<I> Send for DynamicRow<I>where I: Send,

§

impl<I> Sync for DynamicRow<I>where I: Sync,

§

impl<I> Unpin for DynamicRow<I>where I: Unpin,

§

impl<I> UnwindSafe for DynamicRow<I>where I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<I, T, ST> AsInExpression<ST> for Iwhere I: IntoIterator<Item = T>, T: AsExpression<ST>, ST: SqlType + TypedExpressionType,

§

type InExpression = Many<ST, T>

Type of the expression returned by AsInExpression::as_in_expression
source§

fn as_in_expression(self) -> <I as AsInExpression<ST>>::InExpression

Construct the diesel query dsl representation of the IN (values) clause for the given type
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<DB, T> FromSqlRow<Untyped, DB> for Twhere DB: Backend, T: QueryableByName<DB>,

source§

fn build_from_row<'a>( row: &impl Row<'a, DB> ) -> Result<T, Box<dyn Error + Sync + Send + 'static, Global>>

See the trait documentation.
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoSql for T

source§

fn into_sql<T>(self) -> Self::Expressionwhere Self: AsExpression<T> + Sized, T: SqlType + TypedExpressionType,

Convert self to an expression for Diesel’s query builder. Read more
source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V