Skip to content

Commit

Permalink
fix(docs): yield db.query (#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
coogleyao authored and dead-horse committed May 16, 2017
1 parent ddd342c commit 5113088
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/source/zh-cn/basics/service.md
Expand Up @@ -20,7 +20,7 @@ title: Service
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;
}
}
Expand Down Expand Up @@ -90,7 +90,7 @@ module.exports = app => {

* find(uid) {
// 假如 我们拿到用户 id 从数据库获取用户详细信息
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}`);

// 假定这里还有一些复杂的计算,然后返回需要的信息。
const picture = yield this.getPicture(uid);
Expand Down

0 comments on commit 5113088

Please sign in to comment.