Skip to content

Commit

Permalink
feat: add support for change streams transaction exclusion option for…
Browse files Browse the repository at this point in the history
… Batch Write (#2070)

* feat: change stream transaction exclusion option for Batch Write

* refactor
  • Loading branch information
alkatrivedi authored Jul 6, 2024
1 parent 30151ca commit 2a9e443
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3289,6 +3289,7 @@ class Database extends common.GrpcServiceObject {
session: session!.formattedName_!,
mutationGroups: mutationGroups.map(mg => mg.proto()),
requestOptions: options?.requestOptions,
excludeTxnFromChangeStream: options?.excludeTxnFromChangeStreams,
}
);
let dataReceived = false;
Expand Down
1 change: 1 addition & 0 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface TimestampBounds {
export interface BatchWriteOptions {
requestOptions?: Pick<IRequestOptions, 'priority' | 'transactionTag'>;
gaxOptions?: CallOptions;
excludeTxnFromChangeStreams?: boolean;
}

export interface RequestOptions {
Expand Down
2 changes: 2 additions & 0 deletions test/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ describe('Database', () => {
requestOptions: {
transactionTag: 'batch-write-tag',
},
excludeTxnFromChangeStream: true,
gaxOptions: {autoPaginate: false},
} as BatchWriteOptions;

Expand Down Expand Up @@ -644,6 +645,7 @@ describe('Database', () => {
session: fakeSession!.formattedName_!,
mutationGroups: mutationGroups.map(mg => mg.proto()),
requestOptions: options?.requestOptions,
excludeTxnFromChangeStream: options?.excludeTxnFromChangeStreams,
}
);

Expand Down

0 comments on commit 2a9e443

Please sign in to comment.