-
Couldn't load subscription status.
- Fork 847
Open
Description
What's the correct way to determine what data needs to be constructed and returned? Obviously, some fields might have a higher cost to populate than others. This is a resolve function:
(*fields)["Classifier"] = &graphql.Field{
Type: classifierType,
Args: graphql.FieldConfigArgument{
"uuid": &graphql.ArgumentConfig{
Type: graphql.ID,
},
},
Resolve: func(p graphql.ResolveParams) (interface{}, error) {
uuid := p.Args["uuid"].(string)
This is ResolveParams:
type ResolveParams struct {
// Source is the source value
Source interface{}
// Args is a map of arguments for current GraphQL request
Args map[string]interface{}
// Info is a collection of information about the current execution state.
Info ResolveInfo
// Context argument is a context value that is provided to every resolve function within an execution.
// It is commonly
// used to represent an authenticated user, or request-specific caches.
Context context.Context
}
The only immediately interesting field here is ResolveInfo, but it, too, doesn't seem to provide the requested fields:
type ResolveInfo struct {
FieldName string
FieldASTs []*ast.Field
ReturnType Output
ParentType Composite
Schema Schema
Fragments map[string]ast.Definition
RootValue interface{}
Operation ast.Definition
VariableValues map[string]interface{}
}
Thanks.
gwuhaolin, sAbakumoff, kellyellis, felixfbecker, fleur and 8 more
Metadata
Metadata
Assignees
Labels
No labels