MCPcopy Index your code
hub / github.com/tinyplex/tinybase / setQueryDefinitionImpl

Function setQueryDefinitionImpl

docs/pseudo.esm.sh/tinybase@9.0.0/index.js:3377–3721  ·  view source on GitHub ↗
(queryId)

Source from the content-addressed store, hash-verified

3375 return queries;
3376 };
3377 const setQueryDefinitionImpl = (queryId) => getResultStore(queryId).transaction(
3378 () => ifNotUndefined(getQueryArgs(queryId), ([build, , sourceIsQuery]) => {
3379 const tableId = getTableId(queryId);
3380 const rootStore = sourceIsQuery ? getResultStore(tableId) : store;
3381 const resultStore2 = getResultStore(queryId);
3382 const paramValues = getParamValues(queryId);
3383 setAdd(redefiningQueryIds, queryId);
3384 resetPreStores(queryId);
3385 resetSourceStores(queryId);
3386 const selectEntries = [];
3387 const joinEntries = [
3388 [void 0, [tableId, void 0, void 0, [], mapNew(), rootStore]]
3389 ];
3390 const wheres = [];
3391 const groupEntries = [];
3392 const havings = [];
3393 const param = (paramId) => objGet(paramValues, paramId);
3394 const select = (arg1, arg2, arg3) => {
3395 const joinedTableId = isTrue(arg1) ? arg2 : arg1;
3396 const joinedCellId = isTrue(arg1) ? arg3 : arg2;
3397 const selectEntry = isFunction(arg1) ? [size(selectEntries) + EMPTY_STRING, arg1] : isUndefined(joinedCellId) ? [arg1, (getTableCell) => getTableCell(arg1)] : [
3398 joinedCellId,
3399 (getTableCell) => isTrue(arg1) ? getTableCell(true, joinedTableId, joinedCellId) : getTableCell(joinedTableId, joinedCellId)
3400 ];
3401 arrayPush(selectEntries, selectEntry);
3402 return {
3403 as: (selectedCellId) => selectEntry[0] = selectedCellId
3404 };
3405 };
3406 const join = (arg1, arg2, arg3, arg4) => {
3407 const joinedTableId = isTrue(arg1) ? arg2 : arg1;
3408 const [fromJoinAlias, onArg] = isTrue(arg1) ? isUndefined(arg4) || isFunction(arg3) ? [void 0, arg3] : [arg3, arg4] : isUndefined(arg3) || isFunction(arg2) ? [void 0, arg2] : [arg2, arg3];
3409 const joinEntry = [
3410 joinedTableId,
3411 [
3412 joinedTableId,
3413 fromJoinAlias,
3414 isFunction(onArg) ? onArg : (getCell) => getCell(onArg),
3415 [],
3416 mapNew(),
3417 isTrue(arg1) ? getResultStore(joinedTableId) : store
3418 ]
3419 ];
3420 arrayPush(joinEntries, joinEntry);
3421 return { as: (joinedTableId2) => joinEntry[0] = joinedTableId2 };
3422 };
3423 const where = (arg1, arg2, arg3, arg4) => arrayPush(
3424 wheres,
3425 isFunction(arg1) ? arg1 : isTrue(arg1) ? (getTableCell) => getTableCell(true, arg2, arg3) === arg4 : isUndefined(arg3) ? (getTableCell) => getTableCell(arg1) === arg2 : (getTableCell) => getTableCell(arg1, arg2) === arg3
3426 );
3427 const group = (selectedCellId, aggregate, aggregateAdd, aggregateRemove, aggregateReplace) => {
3428 const groupEntry = [
3429 selectedCellId,
3430 [
3431 selectedCellId,
3432 isFunction(aggregate) ? [aggregate, aggregateAdd, aggregateRemove, aggregateReplace] : mapGet(numericAggregators, aggregate) ?? [
3433 (_cells, length) => length
3434 ]

Callers 1

setQueryDefinitionFunction · 0.70

Calls 15

buildFunction · 0.85
getResultStoreFunction · 0.70
getTableIdFunction · 0.70
getParamValuesFunction · 0.70
setAddFunction · 0.70
resetPreStoresFunction · 0.70
resetSourceStoresFunction · 0.70
mapNewFunction · 0.70
collIsEmptyFunction · 0.70
collDelFunction · 0.70
mapForEachFunction · 0.70
mapGetFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…