MCPcopy
hub / github.com/tinyplex/tinybase / group

Function group

src/queries/index.ts:468–489  ·  view source on GitHub ↗
(
            selectedCellId: Id,
            aggregate: 'count' | 'sum' | 'avg' | 'min' | 'max' | Aggregate,
            aggregateAdd?: AggregateAdd,
            aggregateRemove?: AggregateRemove,
            aggregateReplace?: AggregateReplace,
          )

Source from the content-addressed store, hash-verified

466 );
467
468 const group = (
469 selectedCellId: Id,
470 aggregate: 'count' | 'sum' | 'avg' | 'min' | 'max' | Aggregate,
471 aggregateAdd?: AggregateAdd,
472 aggregateRemove?: AggregateRemove,
473 aggregateReplace?: AggregateReplace,
474 ) => {
475 const groupEntry: [Id, GroupClause] = [
476 selectedCellId,
477 [
478 selectedCellId,
479 isFunction(aggregate)
480 ? [aggregate, aggregateAdd, aggregateRemove, aggregateReplace]
481 : ((mapGet(
482 numericAggregators,
483 aggregate as Id,
484 ) as Aggregators) ?? [(_cells, length) => length]),
485 ],
486 ];
487 arrayPush(groupEntries, groupEntry);
488 return {as: (groupedCellId: Id) => (groupEntry[0] = groupedCellId)};
489 };
490
491 const having = (
492 arg1: Id | ((getSelectedOrGroupedCell: GetCell) => boolean),

Callers 3

queries.test.tsFile · 0.50
queries.test.tsFile · 0.50

Calls 3

isFunctionFunction · 0.90
mapGetFunction · 0.90
arrayPushFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…