From 89837e78793892af6741722f6d30cdf92f37ded7 Mon Sep 17 00:00:00 2001 From: Yao Mengfei Date: Wed, 17 May 2017 20:41:11 +0800 Subject: [PATCH] fix(docs): yield db.query for en Same as #921. --- docs/source/en/basics/service.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/en/basics/service.md b/docs/source/en/basics/service.md index ee13d3dba7..cc24587c41 100644 --- a/docs/source/en/basics/service.md +++ b/docs/source/en/basics/service.md @@ -20,7 +20,7 @@ Simply speaking, Service is an abstract layer which is used to encapsulate busin module.exports = app => { class User extends app.Service { * find(uid) { - const user = this.ctx.db.query(`select * from user where uid = ${uid}`); + const user = yield this.ctx.db.query(`select * from user where uid = ${uid}`); return user; } } @@ -80,7 +80,7 @@ module.exports = app => { * find(uid) { // suppose we've got user's id and are going to get detailed user information from databases - const user = this.ctx.db.query(`select * from user where uid = ${uid}`); + const user = yield this.ctx.db.query(`select * from user where uid = ${uid}`); // suppose some complex processes should be made here, and demanded informations are returned then. const picture = yield this.getPicture(uid);