Functions that return a table
Hi @nettofarah , this is a super useful tool. Do you know if it would be possible to generate types for functions that return a table? Like for example:
CREATE FUNCTION get_groups()
RETURNS TABLE (
group_id integer,
group_name text
)
LANGUAGE sql
AS $$
-- SELECT ...
$$;
I would expect it to generate:
export interface get_groups {
group_id: number
group_name: string
}
Hey, @joaopaulobdac. Thanks for the suggestion. This is the first time I hear about functions that return tables.
Would you like to start a pull request? I'm happy to help out any way I can. Maybe start with an unit/integration test, and I could help fill in the blanks with some implementation code?
Yeah! I will be occupied in january because I have a couple of important exams in the upcoming weeks but after that I can start. You can use this type of function similarly to a view, with the benefit of being able to pass parameters to it.