ee-query-builder
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -81,3 +81,3 @@ !function(){ | ||
}.bind(this)).join(', ') +')'; | ||
} else return undefined; | ||
} else return ' false'; | ||
} | ||
@@ -84,0 +84,0 @@ } |
@@ -88,3 +88,9 @@ !function(){ | ||
case 'create': | ||
return this._buildCreateQuery(query, parameters); | ||
case 'drop': | ||
return this._buildDropQuery(query, parameters); | ||
default: | ||
@@ -97,4 +103,45 @@ throw new Error('Unknown query mode «'+mode+'»!').setName('InvalidModeException'); | ||
/** | ||
* build a create query | ||
* | ||
* @param <object> query | ||
* @param <object> parameters | ||
*/ | ||
, _buildCreateQuery: function(query, parameters) { | ||
if (type.string(query.database)) { | ||
return {SQLString: 'CREATE DATABASE '+this._escapeId(query.database)+';', parameters: parameters}; | ||
} | ||
else if (type.string(query.schema)) { | ||
return {SQLString: 'CREATE SCHEMA '+this._escapeId(query.schema)+';', parameters: parameters}; | ||
} | ||
else { | ||
throw new Error('Unknown create statement!'); | ||
} | ||
} | ||
/** | ||
* build a drop query | ||
* | ||
* @param <object> query | ||
* @param <object> parameters | ||
*/ | ||
, _buildDropQuery: function(query, parameters) { | ||
if (type.string(query.database)) { | ||
return {SQLString: 'DROP DATABASE '+this._escapeId(query.database)+';', parameters: parameters}; | ||
} | ||
else if (type.string(query.schema)) { | ||
return {SQLString: 'DROP SCHEMA '+this._escapeId(query.schema)+';', parameters: parameters}; | ||
} | ||
else { | ||
throw new Error('Unknown drop statement!'); | ||
} | ||
} | ||
/** | ||
* creates an SQL delete statement | ||
@@ -101,0 +148,0 @@ * |
{ | ||
"name" : "ee-query-builder" | ||
, "description" : "SQL query builder for the ee-orm package. Implents the postgres syntax." | ||
, "version" : "0.4.0" | ||
, "version" : "0.5.0" | ||
, "homepage" : "https://github.com/eventEmitter/ee-query-builder" | ||
@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)" |
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
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
gql-query-builder |
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
27679
694
0
14