genql: quick hack at variables
This commit is contained in:
+11
-1
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/vektah/gqlparser/ast"
|
||||
)
|
||||
|
||||
func typeFor(operation *ast.OperationDefinition, schema *ast.Schema) string {
|
||||
func typeForOperation(operation *ast.OperationDefinition, schema *ast.Schema) string {
|
||||
var builder strings.Builder
|
||||
|
||||
writeSelectionSetStruct(&builder, operation.SelectionSet, schema)
|
||||
@@ -15,6 +15,16 @@ func typeFor(operation *ast.OperationDefinition, schema *ast.Schema) string {
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
func typeForInputType(typ *ast.Type, schema *ast.Schema) string {
|
||||
var builder strings.Builder
|
||||
|
||||
// TODO: handle non-scalar types (by passing ...something... as the
|
||||
// SelectionSet?)
|
||||
writeType(&builder, typ, nil, schema)
|
||||
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
func writeSelectionSetStruct(builder *strings.Builder, selectionSet ast.SelectionSet, schema *ast.Schema) {
|
||||
builder.WriteString("struct {\n")
|
||||
for _, selection := range selectionSet {
|
||||
|
||||
Reference in New Issue
Block a user