fix(core): update

This commit is contained in:
2022-03-02 16:44:09 +01:00
parent ed550b7ff9
commit 4ea0dece4f
3 changed files with 20 additions and 5 deletions

View File

@ -2,19 +2,28 @@ import * as plugins from './smartclickhouse.plugins';
import { SmartClickHouseDb } from './smartclickhouse.classes.smartclickhouse';
export class TimeDataTable {
public static async getTable(smartClickHouseDbRefArg: SmartClickHouseDb, tableNameArg: string) {
public static async getTable (smartClickHouseDbRefArg: SmartClickHouseDb, tableNameArg: string) {
const newTable = new TimeDataTable(smartClickHouseDbRefArg, tableNameArg);
// create table in clickhouse
smartClickHouseDbRefArg;
await smartClickHouseDbRefArg.clickhouseClient.queryPromise(`CREATE TABLE IF NOT EXISTS ${newTable.tableName} (
timestamp DateTime64(3, 'Europe/Berlin'),
message String
) ENGINE=MergeTree() ORDER BY timestamp`);
return newTable;
}
// INSTANCE
public smartClickHouseDbRef: SmartClickHouseDb;
public tableName: string;
constructor(smartClickHouseDbRefArg: SmartClickHouseDb,tableNameArg: string) {
constructor(smartClickHouseDbRefArg: SmartClickHouseDb, tableNameArg: string) {
this.smartClickHouseDbRef = smartClickHouseDbRefArg;
this.tableName = tableNameArg;
}
/**
* stores a json and tries to map it to the nested syntax
*/
public async storeJson () {}
}