mirror of https://gitee.com/bigwinds/arangodb
Updated AQB to 1.11.0.
This commit is contained in:
parent
c8a96b73f8
commit
be913280f2
File diff suppressed because one or more lines are too long
|
@ -490,6 +490,13 @@ PartialStatement.prototype.remove = function (expr) {
|
|||
};
|
||||
return {into: inFn, 'in': inFn, in_: inFn};
|
||||
};
|
||||
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) {
|
||||
var self = this, inFn;
|
||||
inFn = function (collection) {
|
||||
|
@ -506,7 +513,7 @@ PartialStatement.prototype.update = function (expr) {
|
|||
return {into: inFn, 'in': inFn, in_: inFn};
|
||||
};
|
||||
inFn = function (collection) {
|
||||
return new ReplaceExpression(self, expr, undefined, collection);
|
||||
return new UpdateExpression(self, expr, undefined, collection);
|
||||
};
|
||||
return {'with': withFn, with_: withFn, into: inFn, 'in': inFn, in_: inFn};
|
||||
};
|
||||
|
@ -810,6 +817,23 @@ RemoveExpression.prototype.toAQL = function () {
|
|||
);
|
||||
};
|
||||
|
||||
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) {
|
||||
this.prev = prev;
|
||||
this.expr = autoCastToken(expr);
|
||||
|
@ -894,6 +918,7 @@ exports.SortExpression = SortExpression;
|
|||
exports.LimitExpression = LimitExpression;
|
||||
exports.ReturnExpression = ReturnExpression;
|
||||
exports.RemoveExpression = RemoveExpression;
|
||||
exports.UpsertExpression = UpsertExpression;
|
||||
exports.InsertExpression = InsertExpression;
|
||||
exports.UpdateExpression = UpdateExpression;
|
||||
exports.ReplaceExpression = ReplaceExpression;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"aqb": "1.10.0",
|
||||
"aqb": "1.11.0",
|
||||
"chai": "2.2.0",
|
||||
"coffee-script": "1.9.1",
|
||||
"error-stack-parser": "1.2.0",
|
||||
|
|
Loading…
Reference in New Issue