total rewrite to interface handling; not complete but it compiles

This commit is contained in:
Ben Kraft
2020-07-16 13:28:43 -07:00
parent af4a765a32
commit cf7136ca65
33 changed files with 712 additions and 173 deletions
+48 -12
View File
@@ -1,15 +1,51 @@
type Response struct {
Me *struct {
Roles []role `json:"roles"`
}
OtherUser *struct {
Roles []role `json:"roles"`
}
}
package test
type role string
// Code generated by github.com/Khan/genql, DO NOT EDIT.
import (
"context"
"github.com/Khan/genql/graphql"
)
type Role string
const (
studentRole role = "STUDENT"
teacherRole role = "TEACHER"
)
StudentRole Role = "STUDENT"
TeacherRole Role = "TEACHER"
)
type Role1 string
const (
StudentRole1 Role1 = "STUDENT"
TeacherRole1 Role1 = "TEACHER"
)
type User struct {
Roles []Role `json:"roles"`
}
type User1 struct {
Roles []Role1 `json:"roles"`
}
type UsesEnumTwiceQueryResponse struct {
Me *User
OtherUser *User1
}
func UsesEnumTwiceQuery(client *graphql.Client) (*UsesEnumTwiceQueryResponse, error) {
var retval UsesEnumTwiceQueryResponse
err := client.MakeRequest(context.Background(), `
query UsesEnumTwiceQuery {
Me: user {
roles
}
OtherUser: user {
roles
}
}
`, &retval, nil)
return &retval, err
}