MCPcopy Create free account
hub / github.com/TanStack/db / concat

Function concat

packages/db/src/query/builder/functions.ts:305–325  ·  view source on GitHub ↗
(
  ...args: Array<ExpressionLike | ToArrayWrapper<any>>
)

Source from the content-addressed store, hash-verified

303): ConcatToArrayWrapper<T>
304export function concat(...args: Array<ExpressionLike>): BasicExpression<string>
305export function concat(
306 ...args: Array<ExpressionLike | ToArrayWrapper<any>>
307): BasicExpression<string> | ConcatToArrayWrapper<any> {
308 const toArrayArg = args.find(
309 (arg): arg is ToArrayWrapper<any> => arg instanceof ToArrayWrapper,
310 )
311
312 if (toArrayArg) {
313 if (args.length !== 1) {
314 throw new Error(
315 `concat(toArray(...)) currently supports only a single toArray(...) argument`,
316 )
317 }
318 return new ConcatToArrayWrapper(toArrayArg.query)
319 }
320
321 return new Func(
322 `concat`,
323 args.map((arg) => toExpression(arg)),
324 )
325}
326
327// Helper type for coalesce: extracts non-nullish value types from all args
328type CoalesceArgTypes<T extends Array<ExpressionLike>> = {

Callers 9

createBasicTestsFunction · 0.50
createJoinTestsFunction · 0.50
includes.test-d.tsFile · 0.50
createDistinctTestsFunction · 0.50
includes.test.tsFile · 0.50
union-all.test.tsFile · 0.50
createWhereTestsFunction · 0.50
functions.test.tsFile · 0.50

Calls 2

toExpressionFunction · 0.85
mapMethod · 0.45

Tested by 4

createBasicTestsFunction · 0.40
createJoinTestsFunction · 0.40
createDistinctTestsFunction · 0.40
createWhereTestsFunction · 0.40