Include from_sql_function in Diesel

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?

This forum is kind of deprecated. Feel free to move this proposal to discussion section of the github repository. (I should have been clearer about the right location.)
Also try to answer the questions listed here. Additionally note that the linked macro is by no means perfect. It was written with one use case in mind, therefore it will likely fail for the general case. This is also something that should be addressed as part of the feature request.

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?

If that’s the only motivation to add such a macro to diesel I’m not sure if I’m open to such a request, because this reads to me like: I don’t want to spend resources on maintaining that kind of stuff, I expect that others do that for me for free.

Thank you for your comments. I moved it to GitHub and added some thoughts.