@clickhouse/client-common
Advanced tools
Comparing version 0.2.9 to 0.2.10
@@ -1,2 +0,2 @@ | ||
import type { ClickHouseLogLevel, ClickHouseSettings, Connection, ConnectionParams, ConnExecResult, ConnInsertResult, Logger, WithClickHouseSummary } from '@clickhouse/client-common'; | ||
import type { ClickHouseLogLevel, ClickHouseSettings, Connection, ConnectionParams, ConnExecResult, Logger, WithClickHouseSummary } from '@clickhouse/client-common'; | ||
import { type DataFormat } from '@clickhouse/client-common'; | ||
@@ -92,3 +92,16 @@ import type { InputJSON, InputJSONObjectEachRow } from './clickhouse_types'; | ||
} & WithClickHouseSummary; | ||
export type InsertResult = ConnInsertResult; | ||
export type InsertResult = { | ||
/** | ||
* Indicates whether the INSERT statement was executed on the server. | ||
* Will be `false` if there was no data to insert. | ||
* For example: if {@link InsertParams.values} was an empty array, | ||
* the client does not any requests to the server, and {@link executed} is false. | ||
*/ | ||
executed: boolean; | ||
/** | ||
* Empty string if {@link executed} is false. | ||
* Otherwise, either {@link InsertParams.query_id} if it was set, or the id that was generated by the client. | ||
*/ | ||
query_id: string; | ||
} & WithClickHouseSummary; | ||
export type ExecResult<Stream> = ConnExecResult<Stream>; | ||
@@ -95,0 +108,0 @@ export type PingResult = ConnPingResult; |
@@ -110,6 +110,9 @@ "use strict"; | ||
async insert(params) { | ||
if (Array.isArray(params.values) && params.values.length === 0) { | ||
return { executed: false, query_id: '' }; | ||
} | ||
const format = params.format || 'JSONCompactEachRow'; | ||
this.valuesEncoder.validateInsertValues(params.values, format); | ||
const query = getInsertQuery(params, format); | ||
return await this.connection.insert({ | ||
const result = await this.connection.insert({ | ||
query, | ||
@@ -119,2 +122,3 @@ values: this.valuesEncoder.encodeValues(params.values, format), | ||
}); | ||
return { ...result, executed: true }; | ||
} | ||
@@ -121,0 +125,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
declare const _default: "0.2.9"; | ||
declare const _default: "0.2.10"; | ||
export default _default; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '0.2.9'; | ||
exports.default = '0.2.10'; | ||
//# sourceMappingURL=version.js.map |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://clickhouse.com", | ||
"version": "0.2.9", | ||
"version": "0.2.10", | ||
"license": "Apache-2.0", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
233196
3111