Skip to main content

Row

Struct Row 

Source
pub struct Row<'a> { /* private fields */ }
Expand description

Input Block data row

Implementations§

Source§

impl<'a> Row<'a>

Source

pub unsafe fn create(block: &'a ServerBlock, row_index: u64) -> Row<'a>

§Safety

This function should be called after row_index parameter was checked against row array boundary Block Iterators check it

Source

pub fn len(&self) -> usize

Returns the number of columns This number must correspond to the number of fields in the SELECT statement

Source

pub fn is_empty(&self) -> bool

Empty server Data block is the special type of message. It’s used internally and usually cannot be returned to user

Source

pub fn iter_columns(&self) -> Iter<'_, BlockColumn>

Source

pub fn iter_values(&self) -> Iter<'_, ValueRef<'_>>

Source

pub fn value<T>(&'a self, index: usize) -> Result<Option<T>>
where T: 'a, ValueRef<'a>: Value<'a, T>,

Returns row field value converting underlying Sql type to rust data type if the specific conversion is available. Otherwise it returns ConversionError For nullable Sql types if the field contains null value this method returns Ok(None)

Examples found in repository?
examples/insert-select.rs (line 30)
27    fn deserialize(row: Row) -> errors::Result<Self> {
28        let err = || errors::ConversionError::UnsupportedConversion;
29
30        let id: u64 = row.value(0)?.ok_or_else(err)?;
31        let url: &str = row.value(1)?.ok_or_else(err)?;
32        let date: ServerDate = row.value(2)?.ok_or_else(err)?;
33        let client: Uuid = row.value(3)?.ok_or_else(err)?;
34        let ip = row.value(4)?.ok_or_else(err)?;
35        let value: Decimal32 = row.value(5)?.ok_or_else(err)?;
36
37        Ok(Blob {
38            id,
39            date,
40            client,
41            value,
42            url: url.to_string(),
43            ip,
44        })
45    }
Source

pub unsafe fn value_unchecked<T>(&'a self, index: usize) -> Option<T>
where T: 'a, ValueRef<'a>: Value<'a, T>,

The same as value method but without performing any checking.

§Safety

Calling this method with an out of bound ‘index’ value is UB. Panic if this method is called with unsupported data conversion At the moment the driver provides limited number of data conversions. This method should be used only if you know that table data structure will nether change and you know exactly data types every column of the query.

Source

pub fn column_descr(&self, index: usize) -> Option<&BlockColumn>

Source

pub fn column_index(&self, name: &str) -> usize

Returns column index by its name

Source

pub fn deserialize<D: Deserialize>(self) -> Result<D>

Perform transformation Row to Plain object. Requires that object type implements Deserialize trait

Trait Implementations§

Source§

impl<'a> Debug for Row<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Row<'a>

§

impl<'a> !RefUnwindSafe for Row<'a>

§

impl<'a> !Send for Row<'a>

§

impl<'a> !Sync for Row<'a>

§

impl<'a> Unpin for Row<'a>

§

impl<'a> UnsafeUnpin for Row<'a>

§

impl<'a> !UnwindSafe for Row<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V