在没有async/await的情况下,如何使用azure/data table npm包PageDaSynciteRableTerator调用?

hsgswve4  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(212)

出于某些原因,我需要避免使用async/await,而是在co.js帮助下使用yield/generator。我怎样才能消费 PagedAsyncIterableIterator 从…起 @azure/data-table npm包,这是我尝试的非工作代码:

function run() {
  return co(function* exec() {
    yield client.createTable();
    const filter = odata`partitionKey eq ${partitionKey}`;
    let listResults = client.listEntities({ queryOptions: { filter } }).byPage({ maxPageSize: 1 });
    //let result = yield listResults;

    for (let rec of listResults) {
      console.log(103, rec);
    }
  });
};

run()
  .catch((e) =>  console.log('run error:', e))
  .then(() => console.log('finish'));

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题