Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clickhouse-buffer

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clickhouse-buffer - npm Package Compare versions

Comparing version 2.2.3 to 2.3.0

lib/types.d.ts

5

lib/index.d.ts
import { ClickhouseClient } from "@watchdg/clickhouse-client";
export { DEFAULT_DATABASE } from "@watchdg/clickhouse-client";
export { CompressionFormat } from './encoder_decoder';
import type { ColumnType } from "./types";
import type { ClickhouseClientOptions } from "@watchdg/clickhouse-client";

@@ -29,3 +30,2 @@ import { CompressionFormat } from "./encoder_decoder";

}
type columnType = string | number | Date | boolean;
export declare class ClickhouseBuffer {

@@ -53,3 +53,2 @@ private readonly options;

readonly clickhouseClient: ClickhouseClient;
private static fmtRow;
private static maxTimeHandler;

@@ -64,3 +63,3 @@ private static isConditionMet;

private resetFiles;
push(row: Array<columnType>): void;
push(row: Array<ColumnType>): void;
loadFilesToDatabase(): Promise<void>;

@@ -67,0 +66,0 @@ release(): Promise<void>;

33

lib/index.js

@@ -19,18 +19,4 @@ "use strict";

const rows_to_files_1 = require("./rows_to_files");
function removeFiles(paths) {
return Promise.all(paths.map(path => (0, promises_1.rm)(path, { force: true })));
}
const utils_1 = require("./utils");
class ClickhouseBuffer {
static fmtRow(row) {
for (let i = 0, l = row.length; i < l; i++) {
const columnValue = row[i];
if (columnValue instanceof Date) {
row[i] = columnValue.getTime() / 1000 | 0;
}
else if (typeof columnValue == 'boolean') {
row[i] = Number(columnValue);
}
}
return JSON.stringify(row);
}
static maxTimeHandler(self) {

@@ -81,16 +67,3 @@ const rows = self.resetRows();

}, null);
// let stream = filesToStream(Array.from(paths));
//
// const encoder = getEncoder(self.compressed);
//
// if (encoder) {
// stream = stream.pipe(encoder);
// }
//
// await self.clickhouseClient.query({
// query: self.insertStatement,
// data: stream,
// compressed: self.compressed
// });
await removeFiles(paths);
await (0, utils_1.removeFiles)(paths);
})

@@ -181,3 +154,3 @@ .finally(function () {

push(row) {
const rowValue = ClickhouseBuffer.fmtRow(row);
const rowValue = (0, utils_1.fmtRowJSON)(row);
this.rows.push(rowValue);

@@ -184,0 +157,0 @@ if (this.rows.length >= this.maxRowsInMemory) {

{
"name": "clickhouse-buffer",
"version": "2.2.3",
"version": "2.3.0",
"keywords": [

@@ -29,10 +29,10 @@ "clickhouse",

"dependencies": {
"@watchdg/clickhouse-client": "^1.15.3"
"@watchdg/clickhouse-client": "^1.16.0"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"eslint": "^8.38.0",
"@types/jest": "^29.5.1",
"@types/node": "^18.16.0",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"eslint": "^8.39.0",
"jest": "^29.5.0",

@@ -39,0 +39,0 @@ "rimraf": "^5.0.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc