@thisisagile/easy
Version:
Straightforward library for building domain-driven microservice architectures
41 lines (39 loc) • 1.05 kB
JavaScript
import {
convert
} from "./chunk-MDXL65W4.mjs";
import {
isA
} from "./chunk-ZHXKBOK2.mjs";
import {
isBoolean,
isNumber
} from "./chunk-DEJ7A5PY.mjs";
// src/sql/Clause.ts
var quote = (a) => isNumber(a) || isBoolean(a) || isClause(a) ? a.toString() : `'${a}'`;
var Clause = class {
constructor(first, operator, second) {
this.first = first;
this.operator = operator;
this.second = second;
}
and = (other) => new ParathesizedClause(this, "AND", other);
or = (other) => new ParathesizedClause(this, "OR", other);
toString() {
return `${this.first} ${this.operator} ${quote(this.second)}`;
}
};
var ParathesizedClause = class extends Clause {
toString() {
return `(${this.first} ${this.operator} ${quote(this.second)})`;
}
};
var toClause = (first, operator, second, conv = convert.default) => new Clause(first, operator, conv.from(second));
var isClause = (c) => isA(c, "and", "or");
export {
quote,
Clause,
ParathesizedClause,
toClause,
isClause
};
//# sourceMappingURL=chunk-OKPGJD64.mjs.map