MCPcopy Create free account
hub / github.com/devfullcycle/goexpert / Exec

Method Exec

13-GraphQL/graph/generated/generated.go:202–246  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

200}
201
202func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
203 rc := graphql.GetOperationContext(ctx)
204 ec := executionContext{rc, e}
205 inputUnmarshalMap := graphql.BuildUnmarshalerMap(
206 ec.unmarshalInputNewCategory,
207 ec.unmarshalInputNewCourse,
208 )
209 first := true
210
211 switch rc.Operation.Operation {
212 case ast.Query:
213 return func(ctx context.Context) *graphql.Response {
214 if !first {
215 return nil
216 }
217 first = false
218 ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
219 data := ec._Query(ctx, rc.Operation.SelectionSet)
220 var buf bytes.Buffer
221 data.MarshalGQL(&buf)
222
223 return &graphql.Response{
224 Data: buf.Bytes(),
225 }
226 }
227 case ast.Mutation:
228 return func(ctx context.Context) *graphql.Response {
229 if !first {
230 return nil
231 }
232 first = false
233 ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap)
234 data := ec._Mutation(ctx, rc.Operation.SelectionSet)
235 var buf bytes.Buffer
236 data.MarshalGQL(&buf)
237
238 return &graphql.Response{
239 Data: buf.Bytes(),
240 }
241 }
242
243 default:
244 return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation"))
245 }
246}
247
248type executionContext struct {
249 *graphql.OperationContext

Callers 11

CreateMethod · 0.45
CreateMethod · 0.45
CreateMethod · 0.45
CreateMethod · 0.45
TestAddCourseUowFunction · 0.45
TestAddCourseFunction · 0.45
CreateMethod · 0.45
CreateMethod · 0.45
insertProductFunction · 0.45
updateProductFunction · 0.45
deleteProductFunction · 0.45

Calls 2

_QueryMethod · 0.95
_MutationMethod · 0.95

Tested by 2

TestAddCourseUowFunction · 0.36
TestAddCourseFunction · 0.36