假设我已经为Backbone.js写了很好的JavaScript,并使用Marionette.backbone.js):
(function () {
var Application;
$(function () {
Application = new Backbone.Marionette.Application();
Application.addRegions({
top: "#top",
middle: "#middle",
bottom: "#bottom"
});
var topLayout = Backbone.Marionette.ItemView.extend({
template: "#tpl_topLayout",
tagName: "article"
});
var middleLayout = Backbone.Marionette.Layout.extend({
template: "#tpl_middleLayout",
regions: {
left: "#left",
right: "#right"
}
});
var middleLayoutOne = Backbone.Marionette.ItemView.extend({
template: "#tpl_middleLayoutOne",
tagName: "article"
});
var middleLayoutTwo = Backbone.Marionette.ItemView.extend({
template: "#tpl_middleLayoutTwo",
tagName: "article"
});
var bottomLayout = Backbone.Marionette.ItemView.extend({
template: "#tpl_bottomLayout",
tagName: "article"
});
var a = new middleLayout;
a.left.show(new middleLayoutOne);
a.right.show(new middleLayoutTwo); …Run Code Online (Sandbox Code Playgroud) 我想按照以下方式在 Postgres 中创建一个函数:
CREATE OR REPLACE FUNCTION public.getAvailableForms (
get_form_names TEXT[]
) RETURNS TABLE (
id INTEGER,
name TEXT,
location TEXT,
created TIMESTAMP
) AS $$
BEGIN
RETURN QUERY
SELECT *
FROM form
WHERE form.name IN get_form_names;
END;
$$ LANGUAGE plpgsql
SECURITY DEFINER;
Run Code Online (Sandbox Code Playgroud)
但是,它告诉我这WHERE form.name IN get_form_names在语法上是不正确的。
我找不到任何关于如何在 postgres 函数调用中使用数组变量的文档。
无论如何,是否可以在 a 中使用作为函数参数传递的数组值WHERE ... IN?