vektah/gqlparser

How to get each sub queries?

Closed this issue · 1 comments

imjma commented

query is

source := `{
	a:list(size: 2) {
		list(size: 5) {
			list(size: 15) {
				scalar
			}
		}
	}
	b:list(size: 6) {
		list(size: 3) {
			scalar
		}
	}
}`

query := gqlparser.MustLoadQuery(schema, source)

for _, selection := range query.Operations[0].SelectionSet {
}

Any way to get sub query a and b separately in the for range loop?

imjma commented

just query.Operations[0].SelectionSet[0] and query.Operations[0].SelectionSet[1]