collectFields lists the fields a selection set asks for on an object of type concrete. concrete is nil when the object's type isn't known, which happens for interfaces and unions when the response has no __typename.
(sel ast.SelectionSet, concrete *ast.Definition, required, checked bool, out *[]selected)
| 229 | // concrete. concrete is nil when the object's type isn't known, which happens |
| 230 | // for interfaces and unions when the response has no __typename. |
| 231 | func (w *gqlWalker) collectFields(sel ast.SelectionSet, concrete *ast.Definition, required, checked bool, out *[]selected) { |
| 232 | for _, s := range sel { |
| 233 | switch s := s.(type) { |
| 234 | case *ast.Field: |
| 235 | included, known := directiveCondition(s.Directives, w.variables) |
| 236 | if included { |
| 237 | *out = append(*out, selected{field: s, required: required && known, checked: checked}) |
| 238 | } |
| 239 | case *ast.InlineFragment: |
| 240 | w.collectFragment(s.TypeCondition, s.Directives, s.SelectionSet, concrete, required, checked, out) |
| 241 | case *ast.FragmentSpread: |
| 242 | if s.Definition != nil { |
| 243 | w.collectFragment(s.Definition.TypeCondition, s.Directives, s.Definition.SelectionSet, concrete, required, checked, out) |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | func (w *gqlWalker) collectFragment(cond string, dirs ast.DirectiveList, sel ast.SelectionSet, concrete *ast.Definition, required, checked bool, out *[]selected) { |
| 250 | included, known := directiveCondition(dirs, w.variables) |
no test coverage detected