Skip to main content

AnyRowExt

Trait AnyRowExt 

Source
pub trait AnyRowExt {
    // Required methods
    fn get_bool(&self, column: &str) -> Result<bool, Error>;
    fn get_text(&self, column: &str) -> Result<String, Error>;
    fn get_text_opt(&self, column: &str) -> Result<Option<String>, Error>;
}
Expand description

Row helpers for portably stored types.

Required Methods§

Source

fn get_bool(&self, column: &str) -> Result<bool, Error>

Reads a boolean stored as a 0/1 integer (the portable representation, see bind_values). The counterpart to binding a bool.

Source

fn get_text(&self, column: &str) -> Result<String, Error>

Reads a text column as a String, portably. MySQL reports TEXT columns as BLOB through sqlx::Any, so a plain String decode fails there; this falls back to reading the bytes and decoding UTF-8. Use for every text read so the same code works on every backend.

Source

fn get_text_opt(&self, column: &str) -> Result<Option<String>, Error>

The nullable counterpart to [get_text], for a text column that may be NULL.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AnyRowExt for AnyRow

Source§

fn get_bool(&self, column: &str) -> Result<bool, Error>

Source§

fn get_text(&self, column: &str) -> Result<String, Error>

Source§

fn get_text_opt(&self, column: &str) -> Result<Option<String>, Error>

Implementors§