Skip to content
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

Merged
merged 6 commits into from
Aug 8, 2014
Merged

Conversation

rakyll
Copy link
Contributor

@rakyll rakyll commented Aug 7, 2014

Related to #73 and #39.

@stephenplusplus
Copy link
Contributor

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.

@rakyll
Copy link
Contributor Author

rakyll commented Aug 7, 2014

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.

@rakyll
Copy link
Contributor Author

rakyll commented Aug 7, 2014

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.

@stephenplusplus
Copy link
Contributor

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. dataset.get()), would it be beneficial not to require the use of datastore.key(), instead accepting the array we do currently, then creating a new Key object behind the scenes from it?

@rakyll
Copy link
Contributor Author

rakyll commented Aug 7, 2014

would it be beneficial not to require the use of datastore.key()

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.

@stephenplusplus
Copy link
Contributor

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 new - we're breaking this when a key can be constructed with dataset.Key() (I believe with Int and Double as well). Having a bunch of new Key()s passed as arguments could look a little verbose, so for this reason, I would rather see normal arrays passed as arguments, having the new Keys constructed from them internally. Then, when a key must be constructed manually, the new datastore.Key() will be less of an eyesore.

The other option, of course, is just making it dataset.key().

@rakyll
Copy link
Contributor Author

rakyll commented Aug 8, 2014

I'm cool with either way. Another thing I just realized, the convention in JS is upper camel case fns signify a class

Yes, what I do is not kosher :( new Key is pretty verbose, I'd prefer dataset.key or datastore.key. Same with Int and Double.

I would rather see normal arrays passed as arguments

It breaks the reusability of the key instances.

@stephenplusplus
Copy link
Contributor

It would be nice to force consistency. dataset.key is alright with me.

@rakyll
Copy link
Contributor Author

rakyll commented Aug 8, 2014

Lowercased. Will send changes to Int and Double on a different PR.

stephenplusplus added a commit that referenced this pull request Aug 8, 2014
datastore: Introduce Key type
@stephenplusplus stephenplusplus merged commit a9ad149 into googleapis:master Aug 8, 2014
chingor13 pushed a commit that referenced this pull request Sep 9, 2022
* 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>
chingor13 pushed a commit that referenced this pull request Sep 13, 2022
* 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>
sofisl pushed a commit that referenced this pull request Sep 27, 2022
sofisl pushed a commit that referenced this pull request Oct 13, 2022
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.
sofisl pushed a commit that referenced this pull request Oct 13, 2022
- [ ] 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
sofisl pushed a commit that referenced this pull request Nov 11, 2022
sofisl pushed a commit that referenced this pull request Nov 11, 2022
* 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>
sofisl pushed a commit that referenced this pull request Nov 11, 2022
[![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#&#8203;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-->
sofisl pushed a commit that referenced this pull request Nov 11, 2022
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
sofisl pushed a commit that referenced this pull request Nov 11, 2022
sofisl pushed a commit that referenced this pull request Nov 11, 2022
- [ ] 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
sofisl pushed a commit that referenced this pull request Nov 11, 2022
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 468735472

Source-Link: googleapis/googleapis@cfa1b37

Source-Link: googleapis/googleapis-gen@09b7666
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDliNzY2NjY1NjUxMGY1YjAwYjg5M2YwMDNhMGJhNTc2NmY5ZTI1MCJ9
sofisl pushed a commit that referenced this pull request Nov 11, 2022
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
sofisl pushed a commit that referenced this pull request Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants