I try to write a relay-pyqt similar to relay-react, but there are some questions
yanghg-basefx opened this issue · comments
Here are test queries:
{
foo {
id
name
}
}
{
foo {
id
type
}
}
I want to merge these two queries. So I write a simple script:
query1 = parse('{foo{id name}}')
query2 = parse('{foo{id type}}')
type_field = query2.definitions[0].selection_set.selections[0].selection_set.selections[1]
query1.definitions[0].selection_set.selections[0].selection_set.selections.append(type_field)
query3 = parse(print_ast(query1))
So my questions are:
- I found though I append
type_field
to query1, the querySource
are not changed. Will it affect any other thing? - After I append type_field to query1, the query1 has been changed. Did you provide any function to copy Document? Or just use deepcopy directly?
- Did you provide any other helper function to merge two different query?