mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +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
|
|
@ -46,7 +46,10 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
|||
);
|
||||
}
|
||||
|
||||
async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
||||
async function clickhouseQuery(
|
||||
websiteId: string,
|
||||
filters: QueryFilters,
|
||||
): Promise<{ pageviews: number; uniques: number; bounces: number; totaltime: number }[]> {
|
||||
const { rawQuery, getDateQuery, parseFilters } = clickhouse;
|
||||
const { filterQuery, params } = await parseFilters(websiteId, {
|
||||
...filters,
|
||||
|
|
@ -69,12 +72,21 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters) {
|
|||
max(created_at) max_time
|
||||
from website_event
|
||||
where website_id = {websiteId:UUID}
|
||||
and created_at between {startDate:DateTime} and {endDate:DateTime}
|
||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||
and event_type = {eventType:UInt32}
|
||||
${filterQuery}
|
||||
group by session_id, time_series
|
||||
) as t;
|
||||
`,
|
||||
params,
|
||||
);
|
||||
).then(a => {
|
||||
return Object.values(a).map(a => {
|
||||
return {
|
||||
pageviews: Number(a.pageviews),
|
||||
uniques: Number(a.uniques),
|
||||
bounces: Number(a.bounces),
|
||||
totaltime: Number(a.totaltime),
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue