不要怂,就是干,撸起袖子干!

Commit a3185504 by Chia-liang Kao

construct postgresql array from js array

1 parent b37f5ff5
Showing with 3 additions and 0 deletions
...@@ -25,6 +25,9 @@ function pgEscape(val) { ...@@ -25,6 +25,9 @@ function pgEscape(val) {
switch (typeof val) { switch (typeof val) {
case 'boolean': return (val) ? 'true' : 'false'; case 'boolean': return (val) ? 'true' : 'false';
case 'number': return val+''; case 'number': return val+'';
case 'object':
if ({}.toString.call(val).slice(8, -1) === "Array")
return 'ARRAY['+ val.map(function(it) { return pgEscape(it) }).join(',') +']';
} }
if (val instanceof Date) { if (val instanceof Date) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!