标签:src spl 自定义 out code com turn 技术分享 text
hasura graphql 的安装可以参考相关项目
CREATE TABLE sql_function_table (
id SERIAL PRIMARY KEY,
input text NOT NULL,
output text
);
CREATE FUNCTION test_func() RETURNS trigger AS $emp_stamp$
BEGIN
NEW.output := UPPER(NEW.input);
RETURN NEW;
END;
$emp_stamp$ LANGUAGE plpgsql;
CREATE TRIGGER test_trigger BEFORE INSERT OR UPDATE ON sql_function_table
FOR EACH ROW EXECUTE PROCEDURE test_func();
mutation {
insert_sql_function_table (
objects: [
{input: "dalongdemo!"}
]
) {
returning {
output
}
}
}
效果
https://docs.hasura.io/1.0/graphql/manual/schema/sql-functions.html
标签:src spl 自定义 out code com turn 技术分享 text
原文地址:https://www.cnblogs.com/rongfengliang/p/9366751.html