divyenduz / plv8ify

Turn JS/TS files into PLV8 functions
MIT License
139 stars 9 forks source link

New feature: declare function schema #41

Closed mattiarossi closed 9 months ago

mattiarossi commented 9 months ago

Hi, progressing with the use cases for plv8ify, I'd like to add another decoration to allow creating the functions in a specific schema. Right now we're working around this by using prefixes, but it is sub optimal, as we either need to break down the code by schema, or create different scripts in the ci for them.

Would a decoration style like

//@plv8ify-schema <my_custom_schema>
export function my_test() {
  return "test";
}

be acceptable? In this case the generated SQL would be something like:

CREATE OR REPLACE FUNCTION my_custom_schema.my_test() 
...
divyenduz commented 9 months ago

Yes, go for it!

mattiarossi commented 9 months ago

Implemented in V 0.54

divyenduz commented 9 months ago

Done via https://github.com/divyenduz/plv8ify/pull/42

Thank you @mattiarossi for the contribution 🙌🏼