MCPcopy Create free account
hub / github.com/codemix/graph / resolveOrderKey

Function resolveOrderKey

packages/graph/src/astToSteps.ts:3122–3146  ·  view source on GitHub ↗
(
  order: OrderItem,
  aliasMap: Map<string, AliasInfo>,
  useAliasDirectly: boolean,
)

Source from the content-addressed store, hash-verified

3120}
3121
3122function resolveOrderKey(
3123 order: OrderItem,
3124 aliasMap: Map<string, AliasInfo>,
3125 useAliasDirectly: boolean,
3126): string | undefined {
3127 if (order.alias) {
3128 if (useAliasDirectly) {
3129 // WITH ORDER BY: use alias directly since path has it bound after projection
3130 return order.alias;
3131 }
3132
3133 // RETURN ORDER BY: look up source property/variable
3134 const aliasInfo = aliasMap.get(order.alias);
3135 if (aliasInfo?.property) {
3136 return aliasInfo.property;
3137 }
3138 if (aliasInfo) {
3139 return aliasInfo.variable;
3140 }
3141 return order.alias;
3142 }
3143
3144 // ORDER BY variable.property - use property as key
3145 return order.property;
3146}
3147
3148function resolveReturnOrderExpression(
3149 expression: Exclude<OrderItem["expression"], undefined>,

Callers 1

resolveOrderItemFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected