Fixes WhereClause syntax and adds some shorthand
diff --git a/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js b/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
index 473919c..15d992c 100644
--- a/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
+++ b/asterix-app/src/main/resources/sdk/static/js/asterix-sdk-stable.js
@@ -60,8 +60,9 @@
};
-AExpression.prototype.error = function(msg) {
- //return "Asterix FunctionExpression Error: " + msg;
+// Pretty AExpressAliases
+AExpression.prototype.ReturnClause = function(expression) {
+ return this.bind(new ReturnClause(expression));
};
@@ -218,6 +219,12 @@
};
+AQLClause.prototype.ReturnClause = function(expression) {
+ return this.bind(new ReturnClause(expression));
+};
+
+
+
// ForClause
//
// Grammar:
@@ -351,6 +358,40 @@
};
+WhereClause.prototype.and = function() {
+
+ var andClauses = [];
+ for (var expression in arguments) {
+
+ if (arguments[expression] instanceof AExpression) {
+ andClauses.push(arguments[expression].val());
+ }
+ }
+
+ if (andClauses.length > 0) {
+ this._properties["stack"].push(new AExpression().set(andClauses.join(" and ")));
+ }
+
+ return this;
+};
+
+
+WhereClause.prototype.or = function() {
+ var orClauses = [];
+ for (var expression in arguments) {
+
+ if (arguments[expression] instanceof AExpression) {
+ orClauses.push(arguments[expression].val());
+ }
+ }
+
+ if (andClauses.length > 0) {
+ this._properties["stack"].push(new AExpression().set(orClauses.join(" and ")));
+ }
+
+ return this;
+};
+
// LimitClause
// Grammar:
// LimitClause ::= "limit" Expression ( "offset" Expression )?
@@ -554,41 +595,3 @@
var value = AExpression.prototype.val.call(this);
return "(" + value + ")";
};
-
-
-// Functions that can be used to call core expressions/clauses more cleanly
-function AFLWOGR () {
-
-}
-
-function AClause () {
-
-}
-
-function ALetClause () {
-
-}
-
-function AWhereClause () {
-
-}
-
-function AOrderbyClause () {
-
-}
-
-function AGroupClause () {
-
-}
-
-function ALimitClause () {
-
-}
-
-function ADistinctClause () {
-
-}
-
-function AVariable () {
-
-}