pub trait ColumnIndex<T: ?Sized>: Sealed + Debug {
// Required method
fn index(&self, container: &T) -> Result<usize, Error>;
}
Expand description
A type that can be used to index into a Row
or Statement
.
The get
and try_get
methods of Row
accept any type that implements ColumnIndex
.
This trait is implemented for strings which are used to look up a column by name, and for
usize
which is used as a positional index into the row.
This trait is sealed and cannot be implemented for types outside of SQLx.
Required Methods§
Sourcefn index(&self, container: &T) -> Result<usize, Error>
fn index(&self, container: &T) -> Result<usize, Error>
Returns a valid positional index into the row or statement, ColumnIndexOutOfBounds
, or,
ColumnNotFound
.
Implementations on Foreign Types§
Source§impl ColumnIndex<AnyRow> for usize
impl ColumnIndex<AnyRow> for usize
Source§impl ColumnIndex<AnyStatement<'_>> for usize
impl ColumnIndex<AnyStatement<'_>> for usize
Source§impl ColumnIndex<MssqlRow> for &str
Available on crate feature mssql
only.
impl ColumnIndex<MssqlRow> for &str
Available on crate feature
mssql
only.Source§impl ColumnIndex<MssqlRow> for usize
Available on crate feature mssql
only.
impl ColumnIndex<MssqlRow> for usize
Available on crate feature
mssql
only.Source§impl ColumnIndex<MssqlStatement<'_>> for &str
Available on crate feature mssql
only.
impl ColumnIndex<MssqlStatement<'_>> for &str
Available on crate feature
mssql
only.Source§impl ColumnIndex<MssqlStatement<'_>> for usize
Available on crate feature mssql
only.
impl ColumnIndex<MssqlStatement<'_>> for usize
Available on crate feature
mssql
only.Source§impl ColumnIndex<MySqlRow> for &str
Available on crate feature mysql
only.
impl ColumnIndex<MySqlRow> for &str
Available on crate feature
mysql
only.Source§impl ColumnIndex<MySqlRow> for usize
Available on crate feature mysql
only.
impl ColumnIndex<MySqlRow> for usize
Available on crate feature
mysql
only.Source§impl ColumnIndex<MySqlStatement<'_>> for &str
Available on crate feature mysql
only.
impl ColumnIndex<MySqlStatement<'_>> for &str
Available on crate feature
mysql
only.Source§impl ColumnIndex<MySqlStatement<'_>> for usize
Available on crate feature mysql
only.
impl ColumnIndex<MySqlStatement<'_>> for usize
Available on crate feature
mysql
only.Source§impl ColumnIndex<PgRow> for &str
Available on crate feature postgres
only.
impl ColumnIndex<PgRow> for &str
Available on crate feature
postgres
only.Source§impl ColumnIndex<PgRow> for usize
Available on crate feature postgres
only.
impl ColumnIndex<PgRow> for usize
Available on crate feature
postgres
only.Source§impl ColumnIndex<PgStatement<'_>> for &str
Available on crate feature postgres
only.
impl ColumnIndex<PgStatement<'_>> for &str
Available on crate feature
postgres
only.Source§impl ColumnIndex<PgStatement<'_>> for usize
Available on crate feature postgres
only.
impl ColumnIndex<PgStatement<'_>> for usize
Available on crate feature
postgres
only.Source§impl ColumnIndex<SqliteRow> for &str
Available on crate feature sqlite
only.
impl ColumnIndex<SqliteRow> for &str
Available on crate feature
sqlite
only.Source§impl ColumnIndex<SqliteRow> for usize
Available on crate feature sqlite
only.
impl ColumnIndex<SqliteRow> for usize
Available on crate feature
sqlite
only.Source§impl ColumnIndex<SqliteStatement<'_>> for &str
Available on crate feature sqlite
only.
impl ColumnIndex<SqliteStatement<'_>> for &str
Available on crate feature
sqlite
only.Source§impl ColumnIndex<SqliteStatement<'_>> for usize
Available on crate feature sqlite
only.
impl ColumnIndex<SqliteStatement<'_>> for usize
Available on crate feature
sqlite
only.