fix(core): update
This commit is contained in:
parent
ed550b7ff9
commit
4ea0dece4f
@ -9,7 +9,9 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web)"
|
"build": "(tsbuild --web)",
|
||||||
|
"createGrafana": "docker run --name grafana -d -p 4000:3000 grafana/grafana-oss",
|
||||||
|
"createClickhouse": "docker run --name some-clickhouse-server --ulimit nofile=262144:262144 -p 8123:8123 -p 9000:9000 --volume=$PWD/.nogit/testdatabase:/var/lib/clickhouse yandex/clickhouse-server"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@gitzone/tsbuild": "^2.1.25",
|
||||||
|
@ -14,6 +14,10 @@ tap.test('should start the clickhouse db', async () => {
|
|||||||
await testClickhouseDb.start();
|
await testClickhouseDb.start();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
tap.test('should create a timedatatable', async () => {
|
||||||
|
testClickhouseDb.getTable('analytics')
|
||||||
|
})
|
||||||
|
|
||||||
tap.skip.test('should write something to the clickhouse db', async () => {
|
tap.skip.test('should write something to the clickhouse db', async () => {
|
||||||
const result2 = await testClickhouseDb.clickhouseClient.queryPromise(`CREATE TABLE IF NOT EXISTS visits2 (
|
const result2 = await testClickhouseDb.clickhouseClient.queryPromise(`CREATE TABLE IF NOT EXISTS visits2 (
|
||||||
timestamp UInt64,
|
timestamp UInt64,
|
||||||
|
@ -2,19 +2,28 @@ import * as plugins from './smartclickhouse.plugins';
|
|||||||
import { SmartClickHouseDb } from './smartclickhouse.classes.smartclickhouse';
|
import { SmartClickHouseDb } from './smartclickhouse.classes.smartclickhouse';
|
||||||
|
|
||||||
export class TimeDataTable {
|
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);
|
const newTable = new TimeDataTable(smartClickHouseDbRefArg, tableNameArg);
|
||||||
|
|
||||||
// create table in clickhouse
|
// 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
|
// INSTANCE
|
||||||
public smartClickHouseDbRef: SmartClickHouseDb;
|
public smartClickHouseDbRef: SmartClickHouseDb;
|
||||||
public tableName: string;
|
public tableName: string;
|
||||||
|
|
||||||
constructor(smartClickHouseDbRefArg: SmartClickHouseDb,tableNameArg: string) {
|
constructor(smartClickHouseDbRefArg: SmartClickHouseDb, tableNameArg: string) {
|
||||||
this.smartClickHouseDbRef = smartClickHouseDbRefArg;
|
this.smartClickHouseDbRef = smartClickHouseDbRefArg;
|
||||||
this.tableName = tableNameArg;
|
this.tableName = tableNameArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stores a json and tries to map it to the nested syntax
|
||||||
|
*/
|
||||||
|
public async storeJson () {}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user