Skip to content

10.3.3

Compare
Choose a tag to compare
@vitaly-t vitaly-t released this 11 Jan 11:59
· 311 commits to master since this release

Method proc had a limited functionality, without supporting procedures with output parameters. The method's signature has been revised, to let you get the output values + optionally transform them.

Example

Say, you have a procedure like this one:

CREATE OR REPLACE PROCEDURE test_proc(INOUT output1 INT, INOUT output2 TEXT)
LANGUAGE plpgsql AS $$
BEGIN
    output1 := 123;
    output2 := concat(output2, '-hello!');
END;$$;

Then the following calls can be made now:

await db.proc('test_proc', [null, 'world']);
//=> {output1: 123, output2: 'world-hello!'}

await db.proc('test_proc', [null, 'world'], a => a.output2);
//=> 'world-hello!'