Skip to content

Update overviews with more detailed code #1084

@jgeewax

Description

@jgeewax
  • BigQuery
  • Bigtable
  • Compute Engine
  • Datastore
  • DNS
  • Language
  • Logging
  • Prediction
  • Pub/Sub (including autoAck demonstration)
  • Resource Manager
  • Spanner
  • Speech
  • Storage
  • Translate
  • Vision

Right now, clicking on a service (ie, Datastore) in the docs brings me to a page that has a brief overview and then the stuff that happens to be at the top level (like... int and double).

Can we restructure this a smidge?

  1. Move double and int somewhere else (at least in the docs?)
    On this page, I'm really not looking for such a low-level detail, I'm looking for high-level stuff. If I want to get an idea of how to store special types, I'd be looking for a like to "Types" or something along those lines.
  2. The brief overview is fine, but it's bascially a 301 in that it says "you really want the dataset result... take a look at that". Can we make this act as a more friendly and (somewhat) comprehensive overview? Basically "here's the typical use case for [service], and how you write code to do it".

For example, with Datastore:

"""
The gcloud.datastore object gives you some convenience methods, as well as exposes a dataset function. This will allow you to create a dataset, which is the object from which you will interact with the Google Cloud Datastore.

The basic flow is:

  1. Establish a connection to Cloud Datastore:

    var gcloud = require('gcloud')({
      projectId: 'grape-spaceship-123',
      keyFilename: '/path/to/keyfile.json'  // You can get this from the cloud console
    });
    
    var datastore = gcloud.datastore;
    var dataset = datastore.dataset();

    (Now that you have a dataset reference, take a look at the [link to dataset docs])

  2. Add a TodoItem entity (if you don't know what an entity is, click here [link to entity concept on cloud.google.com]):

    var key = dataset.Key('TodoItem');
    var data = {title: "Buy milk", due: new Date('Tue May 12 2015 15:30:00 GMT-0400 (EDT)')};
    
    dataset.save({key: key, data: data}, function(err) {
      if (err) {
        console.log("Uh oh, something went wrong:", err);
      } else {
        console.log("Todo item saved:", key.path); // ['TodoItem', 5669468231434240]
    });
  3. Retrieve your entity by it's key (if you don't know what a key is, click here [link to key concept on cloud.google.com]):

    var key = dataset.key(['TodoItem', 5669468231434240]);
    
    dataset.get(key, function(err, entity) {
      if (err) {
        console.log("Uh oh, something went wrong:", err);
      } else {
        console.log("Your entity is:", entity);
      });

The other things you might want to do are:

  • Run queries ("Give me all TodoItems due tomorrow"): [link to query docs]
  • Do multiple operations in one atomic group: [link to transactions docs]

"""

(And remember -- these code snippets must be tested so that if our code would break them, the tests fail. We can't have docs out there that don't work...)

Metadata

Metadata

Labels

type: docsImprovement to the documentation for an API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions