total rewrite to interface handling; not complete but it compiles
This commit is contained in:
+40
-12
@@ -1,19 +1,47 @@
|
||||
type Response struct {
|
||||
User *struct {
|
||||
Id string `json:"id"`
|
||||
} `json:"user"`
|
||||
}
|
||||
package test
|
||||
|
||||
type role string
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
|
||||
const (
|
||||
studentRole role = "STUDENT"
|
||||
teacherRole role = "TEACHER"
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Khan/genql/graphql"
|
||||
)
|
||||
|
||||
type userQueryInput struct {
|
||||
type QueryWithInputResponse struct {
|
||||
User *User `json:"user"`
|
||||
}
|
||||
|
||||
type Role string
|
||||
|
||||
const (
|
||||
StudentRole Role = "STUDENT"
|
||||
TeacherRole Role = "TEACHER"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
type UserQueryInput struct {
|
||||
Email *string `json:"email"`
|
||||
Name *string `json:"name"`
|
||||
Id *string `json:"id"`
|
||||
Role *role `json:"role"`
|
||||
}
|
||||
Role *Role `json:"role"`
|
||||
}
|
||||
|
||||
func QueryWithInput(client *graphql.Client, query *UserQueryInput) (*QueryWithInputResponse, error) {
|
||||
variables := map[string]interface{}{
|
||||
"query": query,
|
||||
}
|
||||
|
||||
var retval QueryWithInputResponse
|
||||
err := client.MakeRequest(context.Background(), `
|
||||
query QueryWithInput ($query: UserQueryInput) {
|
||||
user(query: $query) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`, &retval, variables)
|
||||
return &retval, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user