Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to define postgres functions and View #908

Open
shiftlabs1 opened this issue Sep 17, 2023 · 0 comments
Open

Provide a way to define postgres functions and View #908

shiftlabs1 opened this issue Sep 17, 2023 · 0 comments
Labels

Comments

@shiftlabs1
Copy link

shiftlabs1 commented Sep 17, 2023

Like we have with deno module definition. It will be nice and powerful if we have a way to define Postgres functions and Views as part of the schema type definition.
if we have a function type (to represent functions and views ) and we define properties like 1. function-type (query or mutation or view) via attribute 2. input parameter (scalar or custom types) 3. return values (scalar or other type) and a function body as string . for e,g

@postgres('functions.sql')
module PostgresFunctions{
@access(true) @function update_employee_status(id:Uuid,status:String):Boolean
@access(true) @view get_employees_with_completedStatus():Set<Employee>
}

The function definition can be pulled from functions.sql matching name, input and output as a way of validating before applying . The query functions can be part of the query. Note that this can also apply to existing postgres db functions (in that case, no sql file name is passed as parameter to the postgres directive )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants