Merge pull request #181 from atsuhiro/fix-book#2

Fix sample code in the book
This commit is contained in:
Sunli 2020-06-19 10:18:05 +08:00 committed by GitHub
commit d1647b8df6
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ impl MyObject {
async fn value_from_db(
&self,
ctx: &Context<'_'>,
ctx: &Context<'_>,
#[arg(desc = "Id of object")] id: i64
) -> FieldResult<String> {
let conn = ctx.data::<DbPool>().take();

View File

@ -23,11 +23,11 @@ impl MyObject {
async fn value_from_db(
&self,
ctx: &Context<'_'>,
ctx: &Context<'_>,
#[arg(desc = "Id of object")] id: i64
) -> FieldResult<String> {
let conn = ctx.data::<DbPool>().take();
Ok(conn.query_something(id)?.name)
}
}
```
```