本文整理汇总了TypeScript中utilities/mongodb-util.findAll函数的典型用法代码示例。如果您正苦于以下问题:TypeScript findAll函数的具体用法?TypeScript findAll怎么用?TypeScript findAll使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findAll函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: async
api.get('/all', async (req: Request, res: Response) => {
try {
res.send(await findAll<Product>(DB_PRODUCTS));
} catch (err) {
res.status(409).json(err);
}
});
开发者ID:joseabril25,项目名称:nem-coinbase-token-sale-api,代码行数:7,代码来源:product.ts
示例2: Address
return new Promise<CoinbaseLookup>(async (resolve, reject) => {
try {
const allCompleted = await findAll<CoinbaseCharge>(DB_COMPLETED_COINBASE_TRANSACTIONS);
const allProblems = await findAll<CoinbaseCharge>(DB_PROBLEM_COINBASE_CHARGES);
const allPending = await findAll<CoinbaseCharge>(DB_PENDING_COINBASE_CHARGES);
const address = new Address(xemOrTokenAddress).plain();
const filterCompleted = filterChargesByAddress(allCompleted, address);
const filterProblems = filterChargesByAddress(allProblems, address);
const filterPending = filterChargesByAddress(allPending, address);
const results: CoinbaseLookup = {
completed: filterCompleted,
problems: filterProblems,
pending: filterPending
};
resolve(results);
} catch (err) {
reject(err);
}
});
开发者ID:joseabril25,项目名称:nem-coinbase-token-sale-api,代码行数:19,代码来源:coinbase-transaction.ts
示例3: async
api.get('/tokens-sold', async (req: Request, res: Response) => {
try {
const usdTotals: Array<UsdTotal> = await findAll<UsdTotal>(DB_USD_TOTALS);
if (req.query.currency === 'usd' && usdTotals.length > 0) {
return res.send({amount: precisionRound(usdTotals[0].currentRaised, 2), milestone: usdTotals[0].nextMilestone });
}
res.status(409).json({ message: 'object or parameter not found.'});
} catch (err) {
res.status(409).json(err);
}
});
开发者ID:joseabril25,项目名称:nem-coinbase-token-sale-api,代码行数:11,代码来源:info.ts
示例4: async
export const checkPendingTransactions = async () => {
try {
const charges = await findAll<CoinbaseCharge>(DB_PENDING_COINBASE_CHARGES);
if (charges) {
if (charges.length > 0) {
for (const charge of charges) {
fetchCharge(charge);
}
}
}
} catch (err) {}
await sleep(10000);
checkPendingTransactions();
};
开发者ID:joseabril25,项目名称:nem-coinbase-token-sale-api,代码行数:14,代码来源:coinbase-service.ts
注:本文中的utilities/mongodb-util.findAll函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论