As per recommendation in #815 I’m suggesting adding a separate macro for SELECT ... FROM function
.
I suggest that the macro from_sql_function!
is moved almost as is to the diesel package. One good change before it’s moved (in my opinion) is to make it match the current sql_function!
syntax.
Suggested syntax would be:
from_sql_function! {
#[sql_name = "some_function"]
fn my_sql_function(some_var: i32, some_other_var: i32) {
#[sql_name = "id"]
some_id -> i32;
title -> String;
}
}
Just to make sure it gets into the package I would suggest skipping the function meta for now and just add fn
before the function name and otherwise use it as is, since that syntactically allows the addition of meta tags later.
I’m not able to use big copy-pasted (and therefore unmaintained) macros in the project I work on, so having it shipped with the official diesel package would be an absolute game changer for me. Any thoughts on this suggestion?