Write function to customer design doc
lufishggg opened this issue · 0 comments
lufishggg commented
Have you ever consider write some methods to customer design doc? For example, there is a query doc:
doc, _ := gqlparser.LoadQuery(parsedSchema, "mutation($text: String!, $userId: String!) {createTodo(input: {text: $text, userId: $userId}) {id}}")
we can customer design and change the doc ( remove or and some selection, remove or add some arguments), something like:
addArguments(doc, "key"), then the doc will be:
var buf bytes.Buffer
formatter.NewFormatter(&buf).FormatQueryDocument(doc)
fmt.Println(buf.String())
output:
mutation($text: String!, $userId: String!, $key: String!) {createTodo(input: {text: $text, userId: $userId, key: $key}) {id}}"