How to use the @google-cloud/datastore.NO_MORE_RESULTS function in @google-cloud/datastore

To help you get started, we’ve selected a few @google-cloud/datastore 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 anvaka / streak / backend / src / handler / operations / gapi / streakGraph.js View on Github external
.then((results) => {
      const entities = results[0];
      const info = results[1];
      let nextPage = null;
      if (info.moreResults !== Datastore.NO_MORE_RESULTS) {
        nextPage = info.endCursor;
      }

      return {
        nodes: entities.map(toNodeWithId),
        pageCursor: nextPage
      };
    });
}
github anvaka / streak / backend / src / handler / operations / gapi / comments.js View on Github external
return datastore.runQuery(query).then(results => {
    const entities = results[0];
    const info = results[1];
    let nextPage = null;
    if (info.moreResults !== Datastore.NO_MORE_RESULTS) {
      nextPage = info.endCursor;
    }

    return {
      comments: addId(entities),
      pageCursor: nextPage,
    };
  });
}
github doitintl / gSlack / index.js View on Github external
ds.runQuery(query, (err, entities, nextQuery) => {
            if (err) {
                reject(err);
            }
            const hasMore = nextQuery.moreResults !== Datastore.NO_MORE_RESULTS ? nextQuery.endCursor : false;
            if (hasMore) {
                runDSQuery(ds, nextQuery).then(moreEntities => {
                    resolve(entities.concat(moreEntities));
                });
            }
            else {
                resolve(entities);
            }
        });
    });