Comparing version 0.1.1 to 0.1.2
var sq = ""; | ||
var pg; | ||
var fromTable; | ||
@@ -26,2 +27,21 @@ module.exports = { | ||
}, | ||
"insert": function(ins) { | ||
var v = ""; | ||
var ks = "("; | ||
var vs = "("; | ||
Object.keys(ins).map(function(key,index) { | ||
ks += key; | ||
vs += ins[key]; | ||
if (index < ins.length - 1) { | ||
ks += ", "; | ||
vs += ", "; | ||
} | ||
}) | ||
ks += ")"; | ||
vs += ")" | ||
var v = "INSERT INTO " + fromTable + " " + ks + " VALUES " + vs; | ||
sq += v + " "; | ||
return module.exports; | ||
}, | ||
"select": function(values) { | ||
@@ -28,0 +48,0 @@ var v = ""; |
{ | ||
"name": "chaingres", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Postgres: Unchained. Use cascading style programming to structure your Postgres queries.", | ||
@@ -5,0 +5,0 @@ "main": "chaingres.js", |
@@ -21,4 +21,16 @@ # chaingres | ||
//Example INSERT | ||
chaingres | ||
.new(client) | ||
.insert({ | ||
"column1": "value1", | ||
"column2": "value2" | ||
}).then(function(err,result) { | ||
console.log(result); | ||
}) | ||
//Example SELECT | ||
chaingres | ||
.new(client) | ||
.select(["c1", "c2"]) | ||
@@ -25,0 +37,0 @@ .from("table") |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6556
118
58