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

Function buildOrder

packages/trailbase-db-collection/src/trailbase.ts:433–454  ·  view source on GitHub ↗
(opts: LoadSubsetOptions)

Source from the content-addressed store, hash-verified

431}
432
433function buildOrder(opts: LoadSubsetOptions): undefined | Array<string> {
434 return opts.orderBy
435 ?.map((o: OrderByClause) => {
436 switch (o.expression.type) {
437 case 'ref': {
438 const field = o.expression.path[0]
439 if (o.compareOptions.direction == 'asc') {
440 return `+${field}`
441 }
442 return `-${field}`
443 }
444 default: {
445 console.warn(
446 'Skipping unsupported order clause:',
447 JSON.stringify(o.expression),
448 )
449 return undefined
450 }
451 }
452 })
453 .filter((f: string | undefined) => f !== undefined)
454}
455
456function buildCompareOp(name: string): CompareOp | undefined {
457 switch (name) {

Callers 1

loadFunction · 0.85

Calls 2

filterMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected