Skip to content

Commit

Permalink
fmt and regenerate
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Coffman <steve@khanacademy.org>
  • Loading branch information
StevenACoffman committed Jan 13, 2023
1 parent bc2e26d commit f1648cd
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 31 deletions.
7 changes: 4 additions & 3 deletions _examples/chat/chat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package chat

import (
"fmt"
"runtime"
"sync"
"testing"

"github.com/99designs/gqlgen/client"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"runtime"
"sync"
"testing"
)

func TestChatSubscriptions(t *testing.T) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 26 additions & 24 deletions graphql/handler/transport/websocket_resolver_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,35 @@ type subscriptionError struct {

// AddSubscriptionError is used to let websocket return an error message after subscription resolver returns a channel.
// for example:
// func (r *subscriptionResolver) Method(ctx context.Context) (<-chan *model.Message, error) {
// ch := make(chan *model.Message)
// go func() {
// defer func() {
// close(ch)
// }
// // some kind of block processing (e.g.: gRPC client streaming)
// stream, err := gRPCClientStreamRequest(ctx)
// if err != nil {
// transport.AddSubscriptionError(ctx, err)
// return // must return and close channel so websocket can send error back
// }
// for {
// m, err := stream.Recv()
// if err == io.EOF {
// return
// }
//
// func (r *subscriptionResolver) Method(ctx context.Context) (<-chan *model.Message, error) {
// ch := make(chan *model.Message)
// go func() {
// defer func() {
// close(ch)
// }
// // some kind of block processing (e.g.: gRPC client streaming)
// stream, err := gRPCClientStreamRequest(ctx)
// if err != nil {
// transport.AddSubscriptionError(ctx, err)
// return // must return and close channel so websocket can send error back
// transport.AddSubscriptionError(ctx, err)
// return // must return and close channel so websocket can send error back
// }
// for {
// m, err := stream.Recv()
// if err == io.EOF {
// return
// }
// if err != nil {
// transport.AddSubscriptionError(ctx, err)
// return // must return and close channel so websocket can send error back
// }
// ch <- m
// }
// ch <- m
// }
// }()
// }()
//
// return ch, nil
// }
//
// return ch, nil
//}
// see https://github.com/99designs/gqlgen/pull/2506 for more details
func AddSubscriptionError(ctx context.Context, err *gqlerror.Error) {
subscriptionErrStruct := getSubscriptionErrorStruct(ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package generated
import "errors"

// Errors defined for retained code that we want to stick around between generations.
//
var (
ErrResolvingHelloWithErrorsByName = errors.New("error resolving HelloWithErrorsByName")
ErrEmptyKeyResolvingHelloWithErrorsByName = errors.New("error (empty key) resolving HelloWithErrorsByName")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package return_values

import (
"github.com/stretchr/testify/require"
"reflect"
"testing"

"github.com/stretchr/testify/require"
)

//go:generate rm -f resolvers.go
Expand Down

0 comments on commit f1648cd

Please sign in to comment.