askedFields lists the fields that GraphQL requests with this name asked for, or nil if there were none whose query could be read.
(requests []loggedRequest, name string)
| 376 | // askedFields lists the fields that GraphQL requests with this name asked |
| 377 | // for, or nil if there were none whose query could be read. |
| 378 | func askedFields(requests []loggedRequest, name string) map[string]bool { |
| 379 | var fields map[string]bool |
| 380 | for _, e := range requests { |
| 381 | if displayName(e) != name || e.GraphQL == nil { |
| 382 | continue |
| 383 | } |
| 384 | paths := queryFields(e.GraphQL.Query, e.GraphQL.Operation) |
| 385 | if paths == nil { |
| 386 | continue |
| 387 | } |
| 388 | if fields == nil { |
| 389 | fields = map[string]bool{} |
| 390 | } |
| 391 | for path := range paths { |
| 392 | fields[path] = true |
| 393 | } |
| 394 | } |
| 395 | return fields |
| 396 | } |
| 397 | |
| 398 | // joinLimited joins items, showing at most limit of them. |
| 399 | func joinLimited(items []string, limit int) string { |
no test coverage detected