Refine api style for change set

This commit is contained in:
WQY\qiong
2022-10-09 23:25:31 +08:00
parent 69db29d981
commit 231304f73a
5 changed files with 112 additions and 41 deletions

View File

@@ -1,5 +1,8 @@
drop function if exists execute_undo;
drop function if exists add_operation;
drop function if exists get_current_operation;
create function get_current_operation() returns integer as
$$
select id from current_operation as result;
@@ -7,9 +10,7 @@ $$
language sql;
drop function if exists add_operation;
create function add_operation(redo_sql text, undo_sql text, redo_cs json, undo_cs json) returns void as
create function add_operation(redo_sql text, undo_sql text, redo_cs jsonb, undo_cs jsonb) returns void as
$$
declare
parent_id integer;
@@ -30,9 +31,7 @@ $$
language plpgsql;
drop function if exists execute_undo;
create function execute_undo(discard boolean) returns json as
create function execute_undo(discard boolean) returns jsonb as
$$
#print_strict_params on
@@ -42,7 +41,7 @@ declare
begin
select * into strict op_row from operation where id = get_current_operation();
if op_row.undo = '' then
return '{}'::json;
return '{}'::jsonb;
end if;
execute op_row.undo;
@@ -66,7 +65,7 @@ $$
language plpgsql;
-- create function execute_redo() returns json as
-- create function execute_redo() returns jsonb as
-- $$
-- #print_strict_params on
--