Session properties.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ClickHouseClient, createClient } from '@clickhouse/client';
|
||||
import { formatInTimeZone } from 'date-fns-tz';
|
||||
import debug from 'debug';
|
||||
import { CLICKHOUSE } from 'lib/db';
|
||||
import { DEFAULT_PAGE_SIZE, OPERATORS } from './constants';
|
||||
@@ -48,6 +49,10 @@ function getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
function getUTCString(date?: Date) {
|
||||
return formatInTimeZone(date || new Date(), 'UTC', 'yyyy-MM-dd HH:mm:ss');
|
||||
}
|
||||
|
||||
function getDateStringSQL(data: any, unit: string = 'utc', timezone?: string) {
|
||||
if (timezone) {
|
||||
return `formatDateTime(${data}, '${CLICKHOUSE_DATE_FORMATS[unit]}', '${timezone}')`;
|
||||
@@ -221,6 +226,7 @@ export default {
|
||||
getDateStringSQL,
|
||||
getDateSQL,
|
||||
getFilterQuery,
|
||||
getUTCString,
|
||||
parseFilters,
|
||||
pagedQuery,
|
||||
findUnique,
|
||||
|
||||
Reference in New Issue
Block a user