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

docs(key): copy Datastore#key examples to Key ctor #306

Merged
merged 1 commit into from
Jan 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 30 additions & 1 deletion src/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,39 @@ export namespace entity {
* @param {string} [options.namespace] Optional namespace.
*
* @example
* <caption>Create an incomplete key with a kind value of `Company`.</caption>
* const {Datastore} = require('@google-cloud/datastore');
* const datastore = new Datastore();
* const key = datastore.key('Company');
*
* @example
* <caption>Create a complete key with a kind value of `Company` and id
* `123`.</caption> const {Datastore} = require('@google-cloud/datastore');
* const datastore = new Datastore();
* const key = datastore.key(['Company', 123]);
*
* @example
* <caption>If the ID integer is outside the bounds of a JavaScript Number
* object, create an Int.</caption> const {Datastore} =
* require('@google-cloud/datastore'); const datastore = new Datastore();
* const key = datastore.key([
* 'Company',
* datastore.int('100000000000001234')
* ]);
*
* @example
* const {Datastore} = require('@google-cloud/datastore');
* const datastore = new Datastore();
* // Create a complete key with a kind value of `Company` and name `Google`.
* // Note: `id` is used for numeric identifiers and `name` is used otherwise.
* const key = datastore.key(['Company', 'Google']);
*
* @example
* <caption>Create a complete key from a provided namespace and
* path.</caption> const {Datastore} = require('@google-cloud/datastore');
* const datastore = new Datastore();
* const key = datastore.key({
* namespace: 'ns',
* namespace: 'My-NS',
* path: ['Company', 123]
* });
*/
Expand Down