MCPcopy Index your code
hub / github.com/TanStack/db / processNonMergeOp

Function processNonMergeOp

packages/db/src/query/compiler/select.ts:99–121  ·  view source on GitHub ↗

* Processes a non-merge operation by setting the field value at the specified alias path

(
  op: Extract<SelectOp, { kind: `field` }>,
  namespacedRow: NamespacedRow,
  selectResults: Record<string, any>,
)

Source from the content-addressed store, hash-verified

97 * Processes a non-merge operation by setting the field value at the specified alias path
98 */
99function processNonMergeOp(
100 op: Extract<SelectOp, { kind: `field` }>,
101 namespacedRow: NamespacedRow,
102 selectResults: Record<string, any>,
103): void {
104 // Support nested alias paths like "meta.author.name"
105 const path = op.alias.split(`.`)
106 assertSafeAliasSegments(path)
107 if (path.length === 1) {
108 selectResults[op.alias] = op.compiled(namespacedRow)
109 } else {
110 let cursor: any = selectResults
111 for (let i = 0; i < path.length - 1; i++) {
112 const seg = path[i]!
113 const next = cursor[seg]
114 if (next == null || typeof next !== `object`) {
115 cursor[seg] = {}
116 }
117 cursor = cursor[seg]
118 }
119 cursor[path[path.length - 1]!] = unwrapVal(op.compiled(namespacedRow))
120 }
121}
122
123/**
124 * Processes a single row to generate select results

Callers 2

processRowFunction · 0.85
compileSelectObjectFunction · 0.85

Calls 2

assertSafeAliasSegmentsFunction · 0.85
unwrapValFunction · 0.85

Tested by

no test coverage detected