2022-03-01 14:03:55 +00:00
|
|
|
import * as plugins from './smartclickhouse.plugins';
|
|
|
|
|
|
|
|
export interface IClickhouseConstructorOptions {
|
|
|
|
url: string;
|
|
|
|
port?: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class ClickhouseDb {
|
|
|
|
public options: IClickhouseConstructorOptions;
|
|
|
|
public clickhouseClient: plugins.clickhouse.ClickHouse;
|
|
|
|
|
|
|
|
constructor(optionsArg: IClickhouseConstructorOptions) {
|
|
|
|
this.options = optionsArg;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* starts the connection to the Clickhouse db
|
|
|
|
*/
|
|
|
|
public start() {
|
2022-03-02 12:20:18 +00:00
|
|
|
this.clickhouseClient = new plugins.clickhouse.ClickHouse({
|
|
|
|
...this.options,
|
|
|
|
basicAuth: null,
|
|
|
|
format: 'json'
|
|
|
|
});
|
2022-03-01 14:03:55 +00:00
|
|
|
}
|
|
|
|
}
|