Skip to content

Commit

Permalink
Fixed CreateTodo method
Browse files Browse the repository at this point in the history
  • Loading branch information
Surfoo committed Jan 19, 2021
1 parent 997da42 commit 08643ee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/content/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ we create the graph.

```go
func (r *mutationResolver) CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error) {
id, _ := rand.Int(rand.Reader, big.NewInt(100000000))
todo := &model.Todo{
Text: input.Text,
ID: fmt.Sprintf("T%d", rand.Int()),
Text: input.Text,
ID: fmt.Sprintf("T%d", id),
User: &model.User{ID: input.UserID, Name: "user " + input.UserID},
}
r.todos = append(r.todos, todo)
Expand Down

0 comments on commit 08643ee

Please sign in to comment.