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

Function join

src/queries/index.ts:421–448  ·  view source on GitHub ↗
(
            arg1: true | Id,
            arg2?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined),
            arg3?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined),
            arg4?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined),
          )

Source from the content-addressed store, hash-verified

419 };
420
421 const join = (
422 arg1: true | Id,
423 arg2?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined),
424 arg3?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined),
425 arg4?: Id | ((getCell: GetCell, rowId: Id) => Id | undefined),
426 ) => {
427 const joinedTableId = (isTrue(arg1) ? arg2 : arg1) as Id;
428 const [fromJoinAlias, onArg] = isTrue(arg1)
429 ? isUndefined(arg4) || isFunction(arg3)
430 ? [undefined, arg3]
431 : [arg3, arg4]
432 : isUndefined(arg3) || isFunction(arg2)
433 ? [undefined, arg2]
434 : [arg2, arg3];
435 const joinEntry: [Id, JoinClause] = [
436 joinedTableId,
437 [
438 joinedTableId,
439 fromJoinAlias,
440 isFunction(onArg) ? onArg : (getCell) => getCell(onArg as Id),
441 [],
442 mapNew(),
443 isTrue(arg1) ? getResultStore(joinedTableId) : store,
444 ] as JoinClause,
445 ];
446 arrayPush(joinEntries, joinEntry);
447 return {as: (joinedTableId: Id) => (joinEntry[0] = joinedTableId)};
448 };
449
450 const where = (
451 arg1: true | Id | ((getTableCell: GetTableCell) => boolean),

Callers 14

forEachDirAndFileFunction · 0.50
copyPackageFilesFunction · 0.50
compileModuleFunction · 0.50
forEachDirAndFileFunction · 0.50
queries.tsFile · 0.50
queries.test.tsFile · 0.50
persisters.test.tsFile · 0.50
createPersisterFunction · 0.50
queries.test.tsFile · 0.50
forEachDeepFileFunction · 0.50
getDocShotRefsFunction · 0.50

Calls 7

isTrueFunction · 0.90
isUndefinedFunction · 0.90
isFunctionFunction · 0.90
mapNewFunction · 0.90
arrayPushFunction · 0.90
getCellFunction · 0.70
getResultStoreFunction · 0.70

Tested by 2

forEachDirAndFileFunction · 0.40
createPersisterFunction · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…