1
0
Fork 0

Updated AQB to 1.11.0.

This commit is contained in:
Alan Plum 2015-06-03 13:53:07 +02:00
parent c8a96b73f8
commit be913280f2
3 changed files with 32 additions and 7 deletions

File diff suppressed because one or more lines are too long

27
js/node/node_modules/aqb/types.js generated vendored
View File

@ -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;

View File

@ -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",