fix(core): update

This commit is contained in:
2024-06-14 16:33:00 +02:00
parent 07895c2767
commit 1aed44f035
12 changed files with 6433 additions and 4208 deletions

View File

@@ -17,7 +17,7 @@ export interface IClickhouseConstructorOptions {
export class SmartClickHouseDb {
public options: IClickhouseConstructorOptions;
public clickhouseClient: ClickhouseHttpClient;
public clickhouseHttpClient: ClickhouseHttpClient;
constructor(optionsArg: IClickhouseConstructorOptions) {
this.options = optionsArg;
@@ -29,7 +29,7 @@ export class SmartClickHouseDb {
public async start(dropOld = false) {
console.log(`Connecting to default database first.`);
// lets connect
this.clickhouseClient = await ClickhouseHttpClient.createAndStart(this.options);
this.clickhouseHttpClient = await ClickhouseHttpClient.createAndStart(this.options);
await this.pingDatabaseUntilAvailable();
console.log(`Create database ${this.options.database}, if it does not exist...`);
await this.createDatabase(dropOld);
@@ -37,9 +37,9 @@ export class SmartClickHouseDb {
public async createDatabase(dropOld: boolean = false) {
if (dropOld) {
await this.clickhouseClient.queryPromise(`DROP DATABASE IF EXISTS ${this.options.database}`);
await this.clickhouseHttpClient.queryPromise(`DROP DATABASE IF EXISTS ${this.options.database}`);
}
await this.clickhouseClient.queryPromise(
await this.clickhouseHttpClient.queryPromise(
`CREATE DATABASE IF NOT EXISTS ${this.options.database}`
);
}
@@ -47,7 +47,7 @@ export class SmartClickHouseDb {
public async pingDatabaseUntilAvailable() {
let available = false;
while (!available) {
available = await this.clickhouseClient.ping().catch((err) => {
available = await this.clickhouseHttpClient.ping().catch((err) => {
return false;
});
if (!available) {