-
-
Save pokutuna/3a6c1f03125275638bd560ca94b7a65f to your computer and use it in GitHub Desktop.
cross version entity failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
datastore: | |
image: google/cloud-sdk:latest | |
command: | |
[ | |
'gcloud', | |
'beta', | |
'emulators', | |
'datastore', | |
'start', | |
'--project=test', | |
'--host-port=0.0.0.0:8500' | |
] | |
ports: | |
- 8500:8500 | |
healthcheck: | |
test: ['CMD', 'curl', 'localhost:8500'] | |
interval: 3s | |
retries: 5 | |
timeout: 15s | |
app: | |
image: node:20-slim | |
environment: | |
DATASTORE_EMULATOR_HOST: datastore:8500 | |
volumes: | |
- ./:/app | |
working_dir: /app | |
depends_on: | |
datastore: | |
condition: service_healthy | |
command: | |
- /bin/sh | |
- -c | |
- 'yarn install && yarn run ts-node index.ts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Datastore as NewerDatastore } from "datastore-newer"; | |
import { Datastore as OlderDatastore } from "datastore-older"; | |
const datastore = new OlderDatastore({ projectId: "test" }); | |
(async () => { | |
const key = datastore.key("item"); | |
const data = { | |
newDouble: NewerDatastore.double(1.1), | |
oldDouble: OlderDatastore.double(2.2), | |
}; | |
await datastore.save({ key, data }); | |
console.log(await datastore.get(key)); | |
/* | |
output | |
--- | |
[ | |
{ | |
newDouble: { type: 'DatastoreDouble', value: 1.1 }, | |
oldDouble: 2.2, | |
[Symbol(KEY)]: Key { namespace: undefined, id: '1', kind: 'item', path: [Getter] } | |
} | |
] | |
*/ | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "cross-version-entity", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"dependencies": { | |
"datastore-newer": "npm:@google-cloud/datastore@7.5.0", | |
"datastore-older": "npm:@google-cloud/datastore@6.6.2", | |
"ts-node": "^10.9.1", | |
"typescript": "^5.0.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment