还在官方Restify回购中询问:#1224
您好,
是否可以使用一个默认格式化程序来处理任何未定义的接受类型。
例如:
UPDATE r
SET Slug = n.NewSlugName
FROM URLRecord r inner join
aaNewURLSlugs n
ON r.Slug = n.OldSlugName;
答案 0 :(得分:0)
从各方面看,这都是不可能的。由于格式化程序存储在字典中,因此无法创建匹配每个输入的键(无论如何都会破坏字典的点......)在JSON之外完成此类事情的唯一方法是使用正则表达式,正则表达式不适用于JSON。
这是我写的一个程序来测试它。
function updateActiveImg(product = firstProduct()){ // returns first available product (I've tested this and this works as desired)
// attempt 1, doesn't work: it does add the class to the correct image, but when I click another it just adds the class to that image whithout removing it from its siblings
$('#product-' + product).addClass('selected').siblings().removeClass('selected');
// attempt 2, doesn't work: this will remove the class from all the cildren, including the one I want selected
$('#product-' + product).addClass('selected').parent().find('.product-images').removeClass('selected');
// attempt 3, doesn't work: thought this was the final solution, but don't see why it wouldn't work
$('#product-' + product).addClass('selected').parent().find('.product-images').not('#product-' + product).removeClass('selected');
}
此处还有一个指向此文档的链接,以防您找到一些我无法看到的提示。 Restify documentation