99designs / 99designs/gqlgen

Extract result from parent resolver in the downstream resolver chains

Aperta
#2,768 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
10.8k
Fork
1.3k
Merge medio
2g 36m
PR unite (30g)
26

Descrizione

### What happened?
With following graphql schema:
```
type Base64Gif {
encoding: String!
}

type Content {
video_url: String!
gif: Base64Gif
}

type Metadata {
content: Content
start_time_sec: String!
}
type Query {
search(query: String!): [Metadata!]!
}
```
The resolvers are as below:
```go
// Search is the resolver for the search field.
func (r *queryResolver) Search(ctx context.Context, query string) ([]*model.Metadata, error) {
...
}
// Content is the resolver for the content field.
func (r *metadataResolver) Content(ctx context.Context, obj *model.Metadata) (*model.Content, error) {
...
}
// Gif is the resolver for the gif field.
func (r *contentResolver) Gif(ctx context.Context, obj *model.Content) (*model.Base64Gif, error) {
// How do I access `start_time_sec` field which is present in the grandparent chain ?
}
```

### versions
- `go run github.com/99designs/gqlgen version`? v0.17.36
- `go version`? go1.21.0 linux/amd64

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.