-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
datastore: Introduce Key type #101
Conversation
Looks awesome! |
@@ -43,6 +43,12 @@ var signToOrderDict = { | |||
'+': 'ASCENDING' | |||
}; | |||
|
|||
function Key(path) { | |||
this.path_ = path; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
No more square brackets! I keep supporting an array path for those who might find it handier to create paths programmatically. JS doesn't have syntactic sugar for variadic arguments :( Regression tests are fixed. PTAL. |
var postKeyId = '123456789'; | ||
|
||
ds.save({ key: ['Post', postKeyId], data: post }, function(err, key) { | ||
var postKey = datastore.Key('Post', 123456789) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Fixed README, PTAL. |
return new entity.Key(path); | ||
} | ||
return new entity.Key([].slice.call(arguments)); | ||
}, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Found a shortcut you can use (noted above), but everything looks good. Just thinking out loud, feel free to inform me why this may not be a good idea... where keys are required (e.g. |
Optionally, we could support that. It could be a little bit confusing for multi get/save/delete operations. On the other hand, most of the time, people won't need to construct a key by hand, rather use an existing key instance retrieved via querying. I'm more concerned about incomplete keys, they are pretty cryptic. |
I'm cool with either way. Another thing I just realized, the convention in JS is upper camel case fns signify a class, thus must be instantiated with The other option, of course, is just making it |
Yes, what I do is not kosher :(
It breaks the reusability of the key instances. |
It would be nice to force consistency. |
Lowercased. Will send changes to Int and Double on a different PR. |
datastore: Introduce Key type
* chore(main): release 2.1.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore(main): release 2.1.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/5b03461e-47c0-40e8-a8ad-c465ee146cc5/targets - [ ] To automatically regenerate this PR, check this box.
🤖 I have created a release \*beep\* \*boop\* --- ## [1.2.0](https://www.github.com/googleapis/nodejs-bigquery-reservation/compare/v1.1.6...v1.2.0) (2021-08-23) ### Features * turns on self-signed JWT feature flag ([#100](https://www.github.com/googleapis/nodejs-bigquery-reservation/issues/100)) ([0047223](https://www.github.com/googleapis/nodejs-bigquery-reservation/commit/004722310ece662732fe60c8941be1b30214ed6d)) ### Bug Fixes * **build:** migrate to using main branch ([#97](https://www.github.com/googleapis/nodejs-bigquery-reservation/issues/97)) ([2e5a332](https://www.github.com/googleapis/nodejs-bigquery-reservation/commit/2e5a332b21067dd73ec6d2b218b87b61b8ebf59e)) * **deps:** google-gax v2.24.1 ([#99](https://www.github.com/googleapis/nodejs-bigquery-reservation/issues/99)) ([3a4cdec](https://www.github.com/googleapis/nodejs-bigquery-reservation/commit/3a4cdec8d028f0d6fd6d8ebc3977c00231b290bb)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
- [ ] Regenerate this pull request now. Committer: @summer-ji-eng PiperOrigin-RevId: 424244721 Source-Link: googleapis/googleapis@4b6b01f Source-Link: googleapis/googleapis-gen@8ac83fb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGFjODNmYmE2MDZkMDA4YzdlOGE0MmU3ZDU1YjY1OTZlYzRiZTM1ZiJ9
🤖 I have created a release *beep* *boop* --- ## [2.1.2](https://togithub.com/googleapis/nodejs-life-sciences/compare/v2.1.1...v2.1.2) (2022-11-10) ### Bug Fixes * **deps:** Use google-gax v3.5.2 ([#101](https://togithub.com/googleapis/nodejs-life-sciences/issues/101)) ([106359e](https://togithub.com/googleapis/nodejs-life-sciences/commit/106359e0689f5085b7fb19ec36d7217648ad556b)) * Preserve default values in x-goog-request-params header ([#94](https://togithub.com/googleapis/nodejs-life-sciences/issues/94)) ([3e9bcad](https://togithub.com/googleapis/nodejs-life-sciences/commit/3e9bcad4fca23646c1170a5f13d30e344bc079d3)) * Regenerated protos JS and TS definitions ([#104](https://togithub.com/googleapis/nodejs-life-sciences/issues/104)) ([9debd1e](https://togithub.com/googleapis/nodejs-life-sciences/commit/9debd1eb1f02efc40d30d48806eb6829cbb9cf78)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
* docs: Updating copyright to 2022 PiperOrigin-RevId: 429555895 Source-Link: googleapis/googleapis@c222724 Source-Link: googleapis/googleapis-gen@2487eca Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjQ4N2VjYWYyODU2ODA4OTkwYzM0ZDliZWRkMzM4NWU1YjJmYzhlYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [jsdoc](https://togithub.com/jsdoc/jsdoc) | [`^3.6.6` -> `^4.0.0`](https://renovatebot.com/diffs/npm/jsdoc/3.6.11/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/compatibility-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc/4.0.0/confidence-slim/3.6.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>jsdoc/jsdoc</summary> ### [`v4.0.0`](https://togithub.com/jsdoc/jsdoc/blob/HEAD/CHANGES.md#​400-November-2022) [Compare Source](https://togithub.com/jsdoc/jsdoc/compare/3.6.11...084218523a7d69fec14a852ce680f374f526af28) - JSDoc releases now use [semantic versioning](https://semver.org/). If JSDoc makes backwards-incompatible changes in the future, the major version will be incremented. - JSDoc no longer uses the [`taffydb`](https://taffydb.com/) package. If your JSDoc template or plugin uses the `taffydb` package, see the [instructions for replacing `taffydb` with `@jsdoc/salty`](https://togithub.com/jsdoc/jsdoc/tree/main/packages/jsdoc-salty#use-salty-in-a-jsdoc-template). - JSDoc now supports Node.js 12.0.0 and later. </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-resource-settings). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNy4xIiwidXBkYXRlZEluVmVyIjoiMzQuMTcuMSJ9-->
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/4de22315-84b1-493d-8da2-dfa7688128f5/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@94421c4
- [ ] Regenerate this pull request now. Committer: @summer-ji-eng PiperOrigin-RevId: 424244721 Source-Link: googleapis/googleapis@4b6b01f Source-Link: googleapis/googleapis-gen@8ac83fb Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGFjODNmYmE2MDZkMDA4YzdlOGE0MmU3ZDU1YjY1OTZlYzRiZTM1ZiJ9
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 468735472 Source-Link: googleapis/googleapis@cfa1b37 Source-Link: googleapis/googleapis-gen@09b7666 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDliNzY2NjY1NjUxMGY1YjAwYjg5M2YwMDNhMGJhNTc2NmY5ZTI1MCJ9
fix: use google-gax v3.3.0 Source-Link: googleapis/synthtool@c73d112 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:b15a6f06cc06dcffa11e1bebdf1a74b6775a134aac24a0f86f51ddf728eb373e
Related to #73 and #39.