2 Commits

Author SHA1 Message Date
d3ef78af11 1.0.5 2022-03-02 16:44:09 +01:00
4ea0dece4f fix(core): update 2022-03-02 16:44:09 +01:00
4 changed files with 23 additions and 8 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@pushrocks/smartclickhouse",
"version": "1.0.4",
"version": "1.0.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@pushrocks/smartclickhouse",
"version": "1.0.4",
"version": "1.0.5",
"license": "MIT",
"dependencies": {
"@depyronick/clickhouse-client": "^1.0.12"

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartclickhouse",
"version": "1.0.4",
"version": "1.0.5",
"private": false,
"description": "an odm for talking to clickhouse",
"main": "dist_ts/index.js",
@ -9,7 +9,9 @@
"license": "MIT",
"scripts": {
"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": {
"@gitzone/tsbuild": "^2.1.25",

View File

@ -14,6 +14,10 @@ tap.test('should start the clickhouse db', async () => {
await testClickhouseDb.start();
})
tap.test('should create a timedatatable', async () => {
testClickhouseDb.getTable('analytics')
})
tap.skip.test('should write something to the clickhouse db', async () => {
const result2 = await testClickhouseDb.clickhouseClient.queryPromise(`CREATE TABLE IF NOT EXISTS visits2 (
timestamp UInt64,

View File

@ -6,7 +6,11 @@ export class TimeDataTable {
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
@ -17,4 +21,9 @@ export class TimeDataTable {
this.smartClickHouseDbRef = smartClickHouseDbRefArg;
this.tableName = tableNameArg;
}
/**
* stores a json and tries to map it to the nested syntax
*/
public async storeJson () {}
}