How to use the google-cloud.datastore function in google-cloud

To help you get started, we’ve selected a few google-cloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googlecodelabs / cloud-nodejs / step-5-user-books / books.js View on Github external
module.exports = function(config) {

  var gcloud = require('google-cloud');

  var datastore = gcloud.datastore({
    projectId: config.projectId,
    keyFilename: config.keyFilename
  });

  var storage = gcloud.storage({
    projectId: config.projectId,
    keyFilename: config.keyFilename
  });

  var bucket = storage.bucket(config.bucketName);

  function getAllBooks(callback) {
    var query = datastore.createQuery(['Book']);
    datastore.runQuery(query, callback);
  }
github googlecodelabs / cloud-nodejs / step-2-create-and-delete-books / books.js View on Github external
module.exports = function(config) {

  var gcloud = require('google-cloud');

  var datastore = gcloud.datastore({
    projectId: config.projectId,
    keyFilename: config.keyFilename
  });

  function getAllBooks(callback) {
    var query = datastore.createQuery(['Book']);
    datastore.runQuery(query, (err, books) => callback(err, books, datastore.KEY));
  }

  function getUserBooks(userId, callback) {
    callback(new Error('books.getUserBooks [Not Yet Implemented]'));
  }

  function addBook(title, author, coverImageData, userId, callback) {
    if (coverImageData)
      return callback(new Error("books.addBook image saving Not Yet Implemented"));
github googlecodelabs / cloud-nodejs / step-1-retrieve-books / books.js View on Github external
module.exports = function(config) {

  var gcloud = require('google-cloud');

  var datastore = gcloud.datastore({
    projectId: config.projectId,
    keyFilename: config.keyFilename
  });

  function getAllBooks(callback) {
    var query = datastore.createQuery(['Book']);
    datastore.runQuery(query, (err, books) => callback(err, books, datastore.KEY));
  }

  function getUserBooks(userId, callback) {
    callback(new Error('books.getUserBooks [Not Yet Implemented]'));
  }

  function addBook(title, author, coverImageData, userId, callback) {
    if (coverImageData)
      return callback(new Error('books.addBook with image [Not Yet Implemented]'));
github googlecodelabs / cloud-nodejs / step-3-book-cover-images / books.js View on Github external
module.exports = function(config) {

  var gcloud = require('google-cloud');

  var datastore = gcloud.datastore({
    projectId: config.projectId,
    keyFilename: config.keyFilename
  });

  var storage = gcloud.storage({
    projectId: config.projectId,
    keyFilename: config.keyFilename
  });

  var bucket = storage.bucket(config.bucketName);

  function getAllBooks(callback) {
    var query = datastore.createQuery(['Book']);
    datastore.runQuery(query, callback);
  }

google-cloud

Deprecated Cloud APIs Client Library for Node.js

Apache-2.0
Latest version published 6 years ago

Package Health Score

62 / 100
Full package analysis