refactoring: move Query/Function logic into Requester class

This commit is contained in:
2019-06-14 17:09:52 +02:00
parent baa2976e80
commit 00d2fa335d
8 changed files with 235 additions and 160 deletions

View File

@@ -24,3 +24,12 @@ INSERT INTO test (id, name) VALUES (1, 'plop') ON CONFLICT DO NOTHING;
INSERT INTO test2 (id, title, test_id) VALUES (1, 'plop', 1) ON CONFLICT DO NOTHING;
INSERT INTO test2 (id, title, test_id) VALUES (2, 'plip', 1) ON CONFLICT DO NOTHING;
INSERT INTO test2 (id, title, test_id) VALUES (3, 'ttt', null) ON CONFLICT DO NOTHING;
CREATE OR REPLACE FUNCTION test_function (name text default 'plop', IN hi text default 'hello', out result json)
LANGUAGE plpgsql
AS
$$
BEGIN
result = json_build_object('id', 3, 'name', 'test');
END;
$$

View File

@@ -1,8 +1,8 @@
CREATE OR REPLACE FUNCTION test_function (name text, IN hi text default 'hello', out result json)
CREATE OR REPLACE FUNCTION test_function (name text default 'plop', IN hi text default 'hello', out result json)
LANGUAGE plpgsql
AS
$$
BEGIN
result = json_build_object('id', 2, 'name', 'test');
result = json_build_object('id', 3, 'name', 'test');
END;
$$