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

Function getRowVirtualMetadata

packages/db/src/query/compiler/group-by.ts:46–73  ·  view source on GitHub ↗
(row: NamespacedRow)

Source from the content-addressed store, hash-verified

44}
45
46function getRowVirtualMetadata(row: NamespacedRow): RowVirtualMetadata {
47 let found = false
48 let allSynced = true
49 let hasLocal = false
50
51 for (const [alias, value] of Object.entries(row as Record<string, unknown>)) {
52 if (alias === `$selected`) continue
53 if (value === null || typeof value !== `object`) continue
54 const asRecord = value as Record<string, unknown>
55 const hasSyncedProp = `$synced` in asRecord
56 const hasOriginProp = `$origin` in asRecord
57 if (!hasSyncedProp && !hasOriginProp) {
58 continue
59 }
60 found = true
61 if (asRecord.$synced === false) {
62 allSynced = false
63 }
64 if (asRecord.$origin === `local`) {
65 hasLocal = true
66 }
67 }
68
69 return {
70 synced: found ? allSynced : true,
71 hasLocal,
72 }
73}
74
75const { sum, count, avg, min, max } = groupByOperators
76

Callers 1

processGroupByFunction · 0.85

Calls 1

entriesMethod · 0.45

Tested by

no test coverage detected