Macro diesel_derives::sql_function_proc

source ยท
sql_function_proc!() { /* proc-macro */ }
๐Ÿ‘ŽDeprecated since 2.2.0: Use [define_sql_function] instead
Expand description

A legacy version of define_sql_function!.

The difference is that it makes the helper type available in a module named the exact same as the function:

โ“˜
sql_function!(fn lower(x: Text) -> Text);

will generate this code:

โ“˜
pub fn lower<X>(x: X) -> lower::HelperType<X> {
    ...
}

pub(crate) mod lower {
    pub type HelperType<X> = ...;
}

This turned out to be an issue for the support of the auto_type feature, which is why define_sql_function! was introduced (and why this is deprecated).

SQL functions declared with this version of the macro will not be usable with #[auto_type] or Selectable select_expression type inference.