Skip to content

Commit

Permalink
Update dep code as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathew Byrne committed Feb 18, 2019
1 parent 6c57603 commit 0bd120b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions docs/content/getting-started-dep.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ $ go run scripts/gqlgen.go
Now we just need to fill in the `not implemented` parts. Update `resolver.go`

```go
//go:generate go run ./scripts/gqlgen.go
package gettingstarted
import (
Expand All @@ -205,7 +203,7 @@ import (
"math/rand"
)
type Resolver struct{
type Resolver struct {
todos []Todo
}
Expand All @@ -221,13 +219,13 @@ func (r *Resolver) Todo() TodoResolver {
type mutationResolver struct{ *Resolver }
func (r *mutationResolver) CreateTodo(ctx context.Context, input NewTodo) (Todo, error) {
todo := Todo{
func (r *mutationResolver) CreateTodo(ctx context.Context, input NewTodo) (*Todo, error) {
todo := &Todo{
Text: input.Text,
ID: fmt.Sprintf("T%d", rand.Int()),
UserID: input.UserID,
}
r.todos = append(r.todos, todo)
r.todos = append(r.todos, *todo)
return todo, nil
}
Expand All @@ -239,8 +237,8 @@ func (r *queryResolver) Todos(ctx context.Context) ([]Todo, error) {
type todoResolver struct{ *Resolver }
func (r *todoResolver) User(ctx context.Context, obj *Todo) (User, error) {
return User{ID: obj.UserID, Name: "user " + obj.UserID}, nil
func (r *todoResolver) User(ctx context.Context, obj *Todo) (*User, error) {
return &User{ID: obj.UserID, Name: "user " + obj.UserID}, nil
}
```
Expand Down

0 comments on commit 0bd120b

Please sign in to comment.