Trait sqlx::Row [−][src]
Represents a single row from the database.
This trait is sealed and cannot be implemented for types outside of SQLx.
Associated Types
Loading content...Required methods
pub fn columns(&self) -> &[<Self::Database as Database>::Column]β
[src]
Gets all columns in this statement.
pub fn try_get_raw<I>(
&self,
index: I
) -> Result<<Self::Database as HasValueRef<'_>>::ValueRef, Error> where
I: ColumnIndex<Self>,
[src]
&self,
index: I
) -> Result<<Self::Database as HasValueRef<'_>>::ValueRef, Error> where
I: ColumnIndex<Self>,
Index into the database row and decode a single value.
Errors
ColumnNotFound
if the column by the given name was not found.ColumnIndexOutOfBounds
if theusize
index was greater than the number of columns in the row.
Provided methods
pub fn is_empty(&self) -> bool
[src]
Returns true
if this row has no columns.
pub fn len(&self) -> usize
[src]
Returns the number of columns in this row.
pub fn column<I>(&self, index: I) -> &<Self::Database as Database>::Column where
I: ColumnIndex<Self>,
[src]
I: ColumnIndex<Self>,
Gets the column information at index
.
A string index can be used to access a column by name and a usize
index
can be used to access a column by position.
Panics
Panics if index
is out of bounds.
See try_column
for a non-panicking version.
pub fn try_column<I>(
&self,
index: I
) -> Result<&<Self::Database as Database>::Column, Error> where
I: ColumnIndex<Self>,
[src]
&self,
index: I
) -> Result<&<Self::Database as Database>::Column, Error> where
I: ColumnIndex<Self>,
Gets the column information at index
or None
if out of bounds.
pub fn get<'r, T, I>(&'r self, index: I) -> T where
T: Decode<'r, Self::Database> + Type<Self::Database>,
I: ColumnIndex<Self>,
[src]
T: Decode<'r, Self::Database> + Type<Self::Database>,
I: ColumnIndex<Self>,
Index into the database row and decode a single value.
A string index can be used to access a column by name and a usize
index
can be used to access a column by position.
Panics
Panics if the column does not exist or its value cannot be decoded into the requested type.
See try_get
for a non-panicking version.
pub fn get_unchecked<'r, T, I>(&'r self, index: I) -> T where
T: Decode<'r, Self::Database>,
I: ColumnIndex<Self>,
[src]
T: Decode<'r, Self::Database>,
I: ColumnIndex<Self>,
Index into the database row and decode a single value.
Unlike get
, this method does not check that the type
being returned from the database is compatible with the Rust type and blindly tries
to decode the value.
Panics
Panics if the column does not exist or its value cannot be decoded into the requested type.
See try_get_unchecked
for a non-panicking version.
pub fn try_get<'r, T, I>(&'r self, index: I) -> Result<T, Error> where
T: Decode<'r, Self::Database> + Type<Self::Database>,
I: ColumnIndex<Self>,
[src]
T: Decode<'r, Self::Database> + Type<Self::Database>,
I: ColumnIndex<Self>,
Index into the database row and decode a single value.
A string index can be used to access a column by name and a usize
index
can be used to access a column by position.
Errors
ColumnNotFound
if the column by the given name was not found.ColumnIndexOutOfBounds
if theusize
index was greater than the number of columns in the row.ColumnDecode
if the value could not be decoded into the requested type.
pub fn try_get_unchecked<'r, T, I>(&'r self, index: I) -> Result<T, Error> where
T: Decode<'r, Self::Database>,
I: ColumnIndex<Self>,
[src]
T: Decode<'r, Self::Database>,
I: ColumnIndex<Self>,
Index into the database row and decode a single value.
Unlike try_get
, this method does not check that the type
being returned from the database is compatible with the Rust type and blindly tries
to decode the value.
Errors
ColumnNotFound
if the column by the given name was not found.ColumnIndexOutOfBounds
if theusize
index was greater than the number of columns in the row.ColumnDecode
if the value could not be decoded into the requested type.
Implementors
impl Row for AnyRow
[src]
type Database = Any
pub fn columns(&self) -> &[AnyColumn]β
[src]
pub fn try_get_raw<I>(
&self,
index: I
) -> Result<<<AnyRow as Row>::Database as HasValueRef<'_>>::ValueRef, Error> where
I: ColumnIndex<AnyRow>,
[src]
&self,
index: I
) -> Result<<<AnyRow as Row>::Database as HasValueRef<'_>>::ValueRef, Error> where
I: ColumnIndex<AnyRow>,
impl Row for MssqlRow
[src]
type Database = Mssql
pub fn columns(&self) -> &[MssqlColumn]β
[src]
pub fn try_get_raw<I>(&self, index: I) -> Result<MssqlValueRef<'_>, Error> where
I: ColumnIndex<MssqlRow>,
[src]
I: ColumnIndex<MssqlRow>,
impl Row for MySqlRow
[src]
type Database = MySql
pub fn columns(&self) -> &[MySqlColumn]β
[src]
pub fn try_get_raw<I>(&self, index: I) -> Result<MySqlValueRef<'_>, Error> where
I: ColumnIndex<MySqlRow>,
[src]
I: ColumnIndex<MySqlRow>,
impl Row for PgRow
[src]
type Database = Postgres
pub fn columns(&self) -> &[PgColumn]β
[src]
pub fn try_get_raw<I>(&self, index: I) -> Result<PgValueRef<'_>, Error> where
I: ColumnIndex<PgRow>,
[src]
I: ColumnIndex<PgRow>,