Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSelect from a sql function #815
Comments
This comment has been minimized.
|
I think for now |
sgrif
closed this
Dec 16, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fluxxu commentedMar 20, 2017
•
edited
Now diesel has a sql_function! macro which allows we map a SQL function to query DSL, but I can't figure out a way to map a function to return a table.
For example, it seems that there is no way to select from this function:
To make diesel compiles, we can
But this generates a query as
which returns a tuple instead of a record set, which causes a DeserializationError.
The query we actually need is:
To generate this query, I tried
To make this compiles, I need to impl QuerySource for function_return_table_t:
My question is should we have a macro like
which impl QuerySource?
sql_function+ impl QuerySource works, but the return type ofsql_functionis useless for this use case.Thanks!