fix(ci): Update CI workflows, build scripts, and export configuration
This commit is contained in:
30
ts_destination_clickhouse/index.ts
Normal file
30
ts_destination_clickhouse/index.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import * as plugins from './slclick.plugins.js';
|
||||
|
||||
export class SmartlogDestinationClickhouse implements plugins.smartlogInterfaces.ILogDestination {
|
||||
// STATIC
|
||||
public static async createAndStart(
|
||||
optionsArg: plugins.smartclickhouse.IClickhouseConstructorOptions
|
||||
) {
|
||||
const destinationClickhouse = new SmartlogDestinationClickhouse(optionsArg);
|
||||
await destinationClickhouse.start();
|
||||
return destinationClickhouse;
|
||||
}
|
||||
|
||||
// INSTANCE
|
||||
private smartclickhouseDb: plugins.smartclickhouse.SmartClickHouseDb;
|
||||
private logTable: plugins.smartclickhouse.TimeDataTable;
|
||||
constructor(options: plugins.smartclickhouse.IClickhouseConstructorOptions) {
|
||||
this.smartclickhouseDb = new plugins.smartclickhouse.SmartClickHouseDb(options);
|
||||
}
|
||||
|
||||
public async start() {
|
||||
await this.smartclickhouseDb.start();
|
||||
this.logTable = await this.smartclickhouseDb.getTable('logs');
|
||||
}
|
||||
|
||||
public async handleLog(
|
||||
logPackage: plugins.smartlogInterfaces.ILogPackage<unknown>
|
||||
): Promise<void> {
|
||||
await this.logTable.addData(logPackage);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user