Skip to content

Why is datastore initialized differently than the other libraries? #593

Description

@ryanseys

See here for what I'm talking about. Seems that once gcloud is initialized, datastore cannot be initialized with different options. I think this is because we delegated it to the dataset object instead but that just is kinda messy. Would it be worth it to change this to be consistent with the other APIs?

Current way:

var gcloud = require('gcloud')(options);
var datastore = gcloud.datastore;
var dataset = datastore.dataset(newOptions);

Proposed way:

var gcloud = require('gcloud')(options);
var datastore = gcloud.datastore(newOptions);
var dataset = datastore.dataset();

ADDITIONAL CRAZY IDEA: What if we just eliminated the dataset altogether? Something like:

var gcloud = require('gcloud')(options);
var datastore = gcloud.datastore(newOptions);
var key = datastore.key('Company');
datastore.save(key, { data: { hello: 'world' } }, callback);

Anything preventing us from doing this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions