You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
834 B
JavaScript
28 lines
834 B
JavaScript
"use strict";
|
|
|
|
const either = require("@validatem/either");
|
|
|
|
const tagAsType = require("../tag-as-type");
|
|
|
|
module.exports = function (operations) {
|
|
const isObjectType = require("./is-object-type")(operations);
|
|
const isExpressionList = require("./is-expression-list")(operations);
|
|
const isConditionList = require("./is-condition-list")(operations);
|
|
const isWhereObjectList = require("./is-where-object-list")(operations);
|
|
|
|
return either([
|
|
// Boolean AND/OR
|
|
[ isExpressionList, tagAsType("expressions") ],
|
|
// Combine (JOIN)
|
|
// FIXME
|
|
// ...
|
|
// Multiple-choice conditions
|
|
[ isWhereObjectList, tagAsType("expressions") ],
|
|
[ either([
|
|
[ isObjectType("sqlExpression") ],
|
|
[ isObjectType("placeholder") ], // for dynamically specified array of values
|
|
[ isConditionList ],
|
|
]), tagAsType("conditions") ],
|
|
]);
|
|
};
|