Merge pull request #181 from atsuhiro/fix-book#2
Fix sample code in the book
This commit is contained in:
commit
d1647b8df6
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue
Block a user