mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 14:47:14 +01:00
update CH rawquery and type
This commit is contained in:
parent
35d45334df
commit
98b7624e8f
17 changed files with 169 additions and 52 deletions
|
|
@ -42,7 +42,10 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
|||
);
|
||||
}
|
||||
|
||||
async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||
async function clickhouseQuery(
|
||||
websiteId: string,
|
||||
filters: QueryFilters,
|
||||
): Promise<{ events: number; fields: number; records: number }> {
|
||||
const { rawQuery, parseFilters } = clickhouse;
|
||||
const { filterQuery, params } = await parseFilters(websiteId, filters);
|
||||
|
||||
|
|
@ -59,11 +62,19 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
|||
count(*) as "total"
|
||||
from event_data
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime} and {endDate:DateTime}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
${filterQuery}
|
||||
group by event_id, event_key
|
||||
) as t
|
||||
`,
|
||||
params,
|
||||
);
|
||||
).then(a => {
|
||||
return Object.values(a).map(a => {
|
||||
return {
|
||||
events: Number(a.events),
|
||||
fields: Number(a.fields),
|
||||
records: Number(a.records),
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue