applies reports whether a fragment on cond applies to an object whose __typename is typename. Without a __typename, every fragment applies.
(cond, typename string)
| 140 | // applies reports whether a fragment on cond applies to an object whose |
| 141 | // __typename is typename. Without a __typename, every fragment applies. |
| 142 | func (t *trimmer) applies(cond, typename string) bool { |
| 143 | if cond == "" || typename == "" || cond == typename { |
| 144 | return true |
| 145 | } |
| 146 | if t.schema == nil || t.schema.Types[typename] == nil { |
| 147 | return true |
| 148 | } |
| 149 | return isA(t.schema, t.schema.Types[typename], cond) |
| 150 | } |
| 151 | |
| 152 | // queryFields lists the response paths a query asks for, such as |
| 153 | // data.repository.issue.title. Fragments are flattened, as they are in the |