Skip to content

Provide a way to define postgres functions and View  #908

Open
@shiftlabs1

Description

@shiftlabs1

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 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions