GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Support for using multiple databases in datastore (#1090) · googleapis/google-cloud-node@7c9fd49

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • handwritten/datastore
    • package.json
    • src
      • index.ts
      • request.ts
    • system-test
      • datastore.ts
    • test
      • index.ts
      • query.ts
      • transaction.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎handwritten/datastore/package.json‎

Copy file name to clipboardExpand all lines: handwritten/datastore/package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"@types/node": "^20.4.9",
6060
"@types/proxyquire": "^1.3.28",
6161
"@types/sinon": "^10.0.0",
62+
"async": "^3.2.4",
6263
"c8": "^8.0.1",
6364
"gapic-tools": "^0.2.0",
6465
"gts": "^5.0.0",
Collapse file

‎handwritten/datastore/src/index.ts‎

Copy file name to clipboardExpand all lines: handwritten/datastore/src/index.ts
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,16 @@ class Datastore extends DatastoreRequest {
700700
);
701701
}
702702

703+
/**
704+
* Gets the database id that all requests will be run against.
705+
*
706+
* @returns {string} The database id that the current client is set to that
707+
* requests will run against.
708+
*/
709+
getDatabaseId(): string | undefined {
710+
return this.options.databaseId;
711+
}
712+
703713
getProjectId(): Promise<string> {
704714
return this.auth.getProjectId();
705715
}
@@ -1818,6 +1828,7 @@ promisifyAll(Datastore, {
18181828
'double',
18191829
'isDouble',
18201830
'geoPoint',
1831+
'getDatabaseId',
18211832
'getProjectId',
18221833
'isGeoPoint',
18231834
'index',
@@ -1898,6 +1909,7 @@ export interface DatastoreOptions extends GoogleAuthOptions {
18981909
namespace?: string;
18991910
apiEndpoint?: string;
19001911
sslCreds?: ChannelCredentials;
1912+
databaseId?: string;
19011913
}
19021914

19031915
export interface KeyToLegacyUrlSafeCallback {
Collapse file

‎handwritten/datastore/src/request.ts‎

Copy file name to clipboardExpand all lines: handwritten/datastore/src/request.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,10 @@ class DatastoreRequest {
992992
}
993993
}
994994

995+
if (datastore.options && datastore.options.databaseId) {
996+
reqOpts.databaseId = datastore.options.databaseId;
997+
}
998+
995999
if (method === 'rollback') {
9961000
reqOpts.transaction = this.id;
9971001
}
@@ -1143,6 +1147,7 @@ export interface RequestConfig {
11431147
reqOpts?: RequestOptions;
11441148
}
11451149
export interface SharedQueryOptions {
1150+
databaseId?: string;
11461151
projectId?: string;
11471152
partitionId?: google.datastore.v1.IPartitionId | null;
11481153
readOptions?: {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.