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§

source

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<PgStatement<'_>> for &str

source§

fn index(&self, statement: &PgStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<SqliteRow> for &str

source§

fn index(&self, row: &SqliteRow) -> Result<usize, Error>

source§

impl<'i> ColumnIndex<AnyStatement<'_>> for &'i strwhere &'i str: AnyColumnIndex,

source§

fn index(&self, statement: &AnyStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<MssqlRow> for usize

source§

fn index(&self, row: &MssqlRow) -> Result<usize, Error>

source§

impl ColumnIndex<MssqlStatement<'_>> for usize

source§

fn index(&self, statement: &MssqlStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<MssqlRow> for &str

source§

fn index(&self, row: &MssqlRow) -> Result<usize, Error>

source§

impl ColumnIndex<PgStatement<'_>> for usize

source§

fn index(&self, statement: &PgStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<MySqlRow> for usize

source§

fn index(&self, row: &MySqlRow) -> Result<usize, Error>

source§

impl<'i> ColumnIndex<AnyRow> for &'i strwhere &'i str: AnyColumnIndex,

source§

fn index(&self, row: &AnyRow) -> Result<usize, Error>

source§

impl ColumnIndex<SqliteStatement<'_>> for &str

source§

fn index(&self, statement: &SqliteStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<PgRow> for &str

source§

fn index(&self, row: &PgRow) -> Result<usize, Error>

source§

impl ColumnIndex<MssqlStatement<'_>> for &str

source§

fn index(&self, statement: &MssqlStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<AnyRow> for usize

source§

fn index(&self, row: &AnyRow) -> Result<usize, Error>

source§

impl ColumnIndex<AnyStatement<'_>> for usize

source§

fn index(&self, statement: &AnyStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<MySqlStatement<'_>> for usize

source§

fn index(&self, statement: &MySqlStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<SqliteStatement<'_>> for usize

source§

fn index(&self, statement: &SqliteStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<PgRow> for usize

source§

fn index(&self, row: &PgRow) -> Result<usize, Error>

source§

impl<T: ?Sized, I: ColumnIndex<T> + ?Sized> ColumnIndex<T> for &I

source§

fn index(&self, row: &T) -> Result<usize, Error>

source§

impl ColumnIndex<MySqlStatement<'_>> for &str

source§

fn index(&self, statement: &MySqlStatement<'_>) -> Result<usize, Error>

source§

impl ColumnIndex<SqliteRow> for usize

source§

fn index(&self, row: &SqliteRow) -> Result<usize, Error>

source§

impl ColumnIndex<MySqlRow> for &str

source§

fn index(&self, row: &MySqlRow) -> Result<usize, Error>

Implementors§