UNPKG

@hf-chimera/store

Version:

Cross-end reactivity API

50 lines (48 loc) 1.5 kB
const require_src = require('./src-YxpDmKvq.cjs'); //#region packages/qb/index.ts var ChimeraQueryBuilder = class ChimeraQueryBuilder { orderRules = []; orderBy(key, desc = false, nulls = require_src.ChimeraOrderNulls.Last) { this.orderRules.push(require_src.chimeraCreateOrderBy(key, desc, nulls)); return this; } filters = []; rootConjunction = "and"; conjunction(type) { this.rootConjunction = type; } buildFilter() { return this.filters.length ? require_src.chimeraCreateConjunction(this.rootConjunction, this.filters) : null; } where(value, op, test) { this.filters.push(require_src.chimeraCreateOperator(op, value, test)); return this; } group(conjunction, builder) { const isNot = conjunction === "not"; const nestedBuilder = new ChimeraQueryBuilder(); !isNot && nestedBuilder.conjunction(conjunction); builder(nestedBuilder); const nestedQuery = nestedBuilder.buildFilter(); nestedQuery && this.filters.push(isNot ? require_src.chimeraCreateNot(nestedQuery) : nestedQuery); return this; } whereNot(value, op, test) { this.filters.push(require_src.chimeraCreateNot(require_src.chimeraCreateOperator(op, value, test))); return this; } build() { return { filter: this.buildFilter(), order: this.orderRules.length ? this.orderRules : null }; } }; //#endregion Object.defineProperty(exports, 'ChimeraQueryBuilder', { enumerable: true, get: function () { return ChimeraQueryBuilder; } }); //# sourceMappingURL=qb-D6vPK6P0.cjs.map