refql
Version:
A Node.js and Deno library for composing and running SQL queries.
27 lines (26 loc) • 735 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const sql_1 = require("../SQLTag/sql");
const consts_1 = require("../common/consts");
const RQLNode_1 = require("./RQLNode");
const type = "refql/Limit";
const prototype = Object.assign({}, RQLNode_1.rqlNodePrototype, {
constructor: Limit,
[consts_1.refqlType]: type,
interpret
});
function Limit(run) {
let limit = Object.create(prototype);
limit.run = (typeof run === "function" ? run : () => run);
return limit;
}
function interpret() {
const { run } = this;
return (0, sql_1.sqlX) `
limit ${run}
`;
}
Limit.isLimit = function (x) {
return x != null && x[consts_1.refqlType] === type;
};
exports.default = Limit;
;