Comparing version 1.10.1 to 1.11.0
{ | ||
"name": "aqb", | ||
"version": "1.10.1", | ||
"version": "1.11.0", | ||
"description": "ArangoDB AQL query builder.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
25
types.js
@@ -493,2 +493,9 @@ /*jshint browserify: true */ | ||
}; | ||
PartialStatement.prototype.upsert = function (upsertExpr) { | ||
var self = this, insertFn; | ||
insertFn = function (insertExpr) { | ||
return new UpsertExpression(self, upsertExpr, insertExpr); | ||
}; | ||
return {insert: insertFn}; | ||
}; | ||
PartialStatement.prototype.insert = function (expr) { | ||
@@ -814,2 +821,19 @@ var self = this, inFn; | ||
function UpsertExpression(prev, upsertExpr, insertExpr) { | ||
this.prev = prev; | ||
this.upsertExpr = autoCastToken(upsertExpr); | ||
this.insertExpr = autoCastToken(insertExpr); | ||
} | ||
UpsertExpression.prototype = new Statement(); | ||
UpsertExpression.prototype.constructor = UpsertExpression; | ||
UpsertExpression.prototype.update = PartialStatement.prototype.update; | ||
UpsertExpression.prototype.replace = PartialStatement.prototype.replace; | ||
UpsertExpression.prototype.toAQL = function () { | ||
return ( | ||
(this.prev ? this.prev.toAQL() + ' ' : '') + | ||
'UPSERT ' + wrapAQL(this.upsertExpr) + | ||
' INSERT ' + wrapAQL(this.insertExpr) | ||
); | ||
}; | ||
function InsertExpression(prev, expr, collection) { | ||
@@ -899,2 +923,3 @@ this.prev = prev; | ||
exports.RemoveExpression = RemoveExpression; | ||
exports.UpsertExpression = UpsertExpression; | ||
exports.InsertExpression = InsertExpression; | ||
@@ -901,0 +926,0 @@ exports.UpdateExpression = UpdateExpression; |
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
70298
1102