resolveCustomFields resolves fields with custom directive. Here is the rough algorithm that it follows. queryUser { name @custom age school { name children class @custom { name numChildren } } cars @custom { name } } For fields with @custom directive 1. There w
(childFields []gqlSchema.Field, parentNodeHeads []fastJsonNode)
| 703 | // For fields without custom directive we recursively call resolveCustomFields and let it do the |
| 704 | // work. |
| 705 | func (genc *graphQLEncoder) resolveCustomFields(childFields []gqlSchema.Field, |
| 706 | parentNodeHeads []fastJsonNode) { |
| 707 | wg := &sync.WaitGroup{} |
| 708 | for _, childField := range childFields { |
| 709 | if childField.Skip() || !childField.Include() { |
| 710 | continue |
| 711 | } |
| 712 | |
| 713 | if childField.IsCustomHTTP() { |
| 714 | wg.Add(1) |
| 715 | go genc.resolveCustomField(childField, parentNodeHeads, wg) |
| 716 | } else if childField.HasCustomHTTPChild() { |
| 717 | wg.Add(1) |
| 718 | go genc.resolveNestedFields(childField, parentNodeHeads, wg) |
| 719 | } |
| 720 | } |
| 721 | // wait for all the goroutines to finish |
| 722 | wg.Wait() |
| 723 | } |
| 724 | |
| 725 | // resolveCustomField resolves the @custom childField by making an external HTTP request and then |
| 726 | // updates the fastJson tree with results of that HTTP request. |
no test coverage detected