clickhouse-ts
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -49,3 +49,3 @@ "use strict"; | ||
else if (__classPrivateFieldGet(this, _RedisCacheManager_options, "f").chunkResolveType === 'events') { | ||
this.emit('chunk', rows); | ||
this.emit('chunk', chunkNamespace, rows); | ||
} | ||
@@ -52,0 +52,0 @@ else { |
@@ -28,3 +28,3 @@ import { ClickhouseNamespace } from './interface'; | ||
useCaching(type: 'redis', client: Redis): void; | ||
onChunk(onChunkCb: (rows: ClickhouseNamespace.InsertRows) => void): void; | ||
onChunk(onChunkCb: (chunkId: string, rows: ClickhouseNamespace.InsertRows) => void): void; | ||
cache(table: string, rows: ClickhouseNamespace.InsertRows): Promise<{ | ||
@@ -31,0 +31,0 @@ chunk: string; |
@@ -16,3 +16,3 @@ "use strict"; | ||
}; | ||
var _Clickhouse_httpClient, _Clickhouse_options, _Clickhouse_cacheClient, _Clickhouse_cacheManager, _Clickhouse_onChunkCb, _Clickhouse_redisClient, _Clickhouse_isFirstInsert; | ||
var _Clickhouse_httpClient, _Clickhouse_options, _Clickhouse_cacheManager, _Clickhouse_onChunkCb, _Clickhouse_redisClient, _Clickhouse_isFirstInsert; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -28,3 +28,2 @@ exports.Clickhouse = void 0; | ||
_Clickhouse_options.set(this, void 0); | ||
_Clickhouse_cacheClient.set(this, void 0); | ||
_Clickhouse_cacheManager.set(this, void 0); | ||
@@ -84,3 +83,3 @@ _Clickhouse_onChunkCb.set(this, void 0); | ||
__classPrivateFieldSet(this, _Clickhouse_redisClient, client, "f"); | ||
__classPrivateFieldGet(this, _Clickhouse_cacheManager, "f").on('chunk', rows => __classPrivateFieldGet(this, _Clickhouse_onChunkCb, "f").forEach(cb => cb(rows))); | ||
__classPrivateFieldGet(this, _Clickhouse_cacheManager, "f").on('chunk', (chunkId, rows) => __classPrivateFieldGet(this, _Clickhouse_onChunkCb, "f").forEach(cb => cb(chunkId, rows))); | ||
} | ||
@@ -104,2 +103,2 @@ onChunk(onChunkCb) { | ||
exports.Clickhouse = Clickhouse; | ||
_Clickhouse_httpClient = new WeakMap(), _Clickhouse_options = new WeakMap(), _Clickhouse_cacheClient = new WeakMap(), _Clickhouse_cacheManager = new WeakMap(), _Clickhouse_onChunkCb = new WeakMap(), _Clickhouse_redisClient = new WeakMap(), _Clickhouse_isFirstInsert = new WeakMap(); | ||
_Clickhouse_httpClient = new WeakMap(), _Clickhouse_options = new WeakMap(), _Clickhouse_cacheManager = new WeakMap(), _Clickhouse_onChunkCb = new WeakMap(), _Clickhouse_redisClient = new WeakMap(), _Clickhouse_isFirstInsert = new WeakMap(); |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"license": "MIT", | ||
@@ -15,0 +15,0 @@ "description": "Clickhouse client on TypeScript using nodejs ot redis caching queries", |
@@ -55,3 +55,3 @@ import dayjs from "dayjs"; | ||
} else if (this.#options.chunkResolveType === 'events') { | ||
this.emit('chunk', rows) | ||
this.emit('chunk', chunkNamespace, rows) | ||
} else { | ||
@@ -58,0 +58,0 @@ throw new Error('resolveType is not correct!') |
import { ClickhouseHttpClient } from '../httpClient/ClickhouseHttpClient' | ||
import sqlstring from 'sqlstring' | ||
import { SystemCache } from '../caching/SystemCache' | ||
import { RedisCache } from '../caching/RedisCache' | ||
import { ClickhouseNamespace } from './interface' | ||
@@ -15,5 +13,4 @@ import { Redis } from 'ioredis' | ||
readonly #options: ClickhouseNamespace.Options | ||
readonly #cacheClient: SystemCache | RedisCache | undefined | ||
readonly #cacheManager?: RedisCacheManager | ||
#onChunkCb: ((rows: ClickhouseNamespace.InsertRows) => void)[] | ||
#onChunkCb: ((chunkId: string, rows: ClickhouseNamespace.InsertRows) => void)[] | ||
#redisClient?: Redis | ||
@@ -91,6 +88,6 @@ #isFirstInsert: boolean | ||
this.#cacheManager.on('chunk', rows => this.#onChunkCb.forEach(cb => cb(rows))) | ||
this.#cacheManager.on('chunk', (chunkId, rows) => this.#onChunkCb.forEach(cb => cb(chunkId, rows))) | ||
} | ||
public onChunk (onChunkCb: (rows: ClickhouseNamespace.InsertRows) => void) { | ||
public onChunk (onChunkCb: (chunkId: string, rows: ClickhouseNamespace.InsertRows) => void) { | ||
this.#onChunkCb.push(onChunkCb) | ||
@@ -97,0 +94,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58386
28
1089