Skip to content

Commit b169b9a

Browse files
committed
added progress count and some renamings
1 parent 8b5abb7 commit b169b9a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sql-data-api",
3-
"version": "0.2.34",
3+
"version": "0.2.35",
44
"description": "Sql Data Api",
55
"keywords": [
66
"sql",

src/sql-data.api.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ export interface SqlReadQueryInfo {
3434
}
3535

3636
export interface SqlSaveOptions {
37-
chunkSize?: number;
38-
primaryKeys: string[];
3937
method: "Merge" | "Append" | "BulkInsert";
40-
batchProgressFunc?: (status: SqlSaveStatus) => void;
38+
batchSize?: number;
39+
primaryKeys?: string[];
40+
batchProgressFunc?: (processedCount: number, status: SqlSaveStatus) => void;
4141
}
4242

4343
export function setBaseUrl(baseUrl: string): void {
@@ -488,7 +488,7 @@ export class SqlDataApi {
488488
saveOptions?: SqlSaveOptions
489489
): Promise<SqlSaveStatus> {
490490
const maxTableSize = 1500000;
491-
const maxRowsCount = saveOptions?.chunkSize || 10000;
491+
const maxRowsCount = saveOptions?.batchSize || 10000;
492492
const primaryKeys = saveOptions?.primaryKeys || undefined;
493493
const batchSavedFunc = saveOptions?.batchProgressFunc;
494494
const saveMethod =
@@ -571,7 +571,7 @@ export class SqlDataApi {
571571
})) as SqlSaveStatus;
572572

573573
if (typeof batchSavedFunc === "function") {
574-
batchSavedFunc(singleStatus);
574+
batchSavedFunc(currentIndex + 1, singleStatus);
575575
}
576576

577577
status.inserted += singleStatus.inserted;
@@ -605,7 +605,7 @@ export class SqlDataApi {
605605
}
606606
}
607607

608-
export function dbTypeConverter() {
608+
export function dbTypeConverter(): DbTypeConverter {
609609
return new DbTypeConverter();
610610
}
611611

0 commit comments

Comments
 (0)