當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript mongodb-util.findAll函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。