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

Function queryEventsCore

packages/db/src/services/event.service.ts:1311–1415  ·  view source on GitHub ↗
(
  input: QueryEventsInput
)

Source from the content-addressed store, hash-verified

1309}
1310
1311export async function queryEventsCore(
1312 input: QueryEventsInput
1313): Promise<IClickhouseEvent[]> {
1314 const builder = clix(ch)
1315 .select<IClickhouseEvent>([])
1316 .from(TABLE_NAMES.events)
1317 .where('project_id', '=', input.projectId);
1318
1319 if (input.sessionId) {
1320 builder.where('session_id', '=', input.sessionId);
1321 }
1322
1323 if (input.profileId) {
1324 builder.where('profile_id', '=', input.profileId);
1325 }
1326
1327 if (input.profileIds?.length) {
1328 builder.where('profile_id', 'IN', input.profileIds);
1329 }
1330
1331 if (input.eventNames?.length) {
1332 builder.where('name', 'IN', input.eventNames);
1333 }
1334
1335 if (input.path) {
1336 builder.where('path', '=', input.path);
1337 }
1338
1339 if (input.referrer) {
1340 builder.where('referrer', '=', input.referrer);
1341 }
1342
1343 if (input.referrerName) {
1344 builder.where('referrer_name', '=', input.referrerName);
1345 }
1346
1347 if (input.referrerType) {
1348 builder.where('referrer_type', '=', input.referrerType);
1349 }
1350
1351 if (input.device) {
1352 builder.where('device', '=', input.device);
1353 }
1354
1355 if (input.country) {
1356 builder.where('country', '=', input.country);
1357 }
1358
1359 if (input.city) {
1360 builder.where('city', '=', input.city);
1361 }
1362
1363 if (input.os) {
1364 builder.where('os', '=', input.os);
1365 }
1366
1367 if (input.browser) {
1368 builder.where('browser', '=', input.browser);

Callers 7

registerEventToolsFunction · 0.90
queryEventsFunction · 0.90
base.tsFile · 0.90
groups.tsFile · 0.90
events.tsFile · 0.90
session.tsFile · 0.90
profile.tsFile · 0.90

Calls 9

clixFunction · 0.90
resolveDateRangeFunction · 0.90
buildFilterWhereFunction · 0.90
selectMethod · 0.80
executeMethod · 0.80
limitMethod · 0.80
whereMethod · 0.45
fromMethod · 0.45
rawWhereMethod · 0.45

Tested by

no test coverage detected