MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getGroupPropertySelect

Function getGroupPropertySelect

packages/db/src/services/chart.service.ts:267–283  ·  view source on GitHub ↗
(property: string)

Source from the content-addressed store, hash-verified

265// Returns the SELECT expression when querying the groups table directly (no join alias).
266// Use for fetching distinct values for group.* properties.
267export function getGroupPropertySelect(property: string): string {
268 const withoutPrefix = property.replace(/^group\./, '');
269 if (withoutPrefix === 'name') {
270 return 'name';
271 }
272 if (withoutPrefix === 'type') {
273 return 'type';
274 }
275 if (withoutPrefix === 'id') {
276 return 'id';
277 }
278 if (withoutPrefix.startsWith('properties.')) {
279 const propKey = withoutPrefix.replace(/^properties\./, '');
280 return `properties[${sqlstring.escape(propKey)}]`;
281 }
282 return 'id';
283}
284
285// Returns the SELECT expression when querying the profiles table directly (no join alias).
286// Use for fetching distinct values for profile.* properties.

Callers 1

chart.tsFile · 0.90

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected