Skip to main content

SqlSafe

Trait SqlSafe 

Source
pub trait SqlSafe {
    // Required method
    fn as_sql(&self) -> &str;
}
Expand description

A trait for types that are safe to interpolate into SQL queries.

Types implementing this trait can be used with the sql_query! macro. The built-in implementations are EscapedIdentifier, EscapedLiteral, and InsecureRawSql.

You may implement this trait for your own types if you have other validated/escaped SQL fragments, but do so with caution.

Required Methods§

Source

fn as_sql(&self) -> &str

Returns the SQL-safe string representation.

Implementations on Foreign Types§

Source§

impl<S: SqlSafe> SqlSafe for Option<S>

Source§

fn as_sql(&self) -> &str

Source§

impl<S: SqlSafe> SqlSafe for &S

Source§

fn as_sql(&self) -> &str

Implementors§