Switch to cupaloy for snapshots

Slightly uglier filenames, but less code and free diffing!  Approved in
ADR-466 for Khan use.  Fixes #23.
This commit is contained in:
Ben Kraft
2021-06-03 12:08:56 -07:00
parent 3c11f07e62
commit 1f442da041
63 changed files with 78 additions and 85 deletions
-39
View File
@@ -1,39 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"time"
"github.com/Khan/genqlient/graphql"
)
// convertTimezoneResponse is returned by convertTimezone on success.
type convertTimezoneResponse struct {
Convert time.Time `json:"convert"`
}
func convertTimezone(
client graphql.Client,
dt time.Time,
tz string,
) (*convertTimezoneResponse, error) {
variables := map[string]interface{}{
"dt": dt,
"tz": tz,
}
var retval convertTimezoneResponse
err := client.MakeRequest(
nil,
"convertTimezone",
`
query convertTimezone ($dt: DateTime!, $tz: String) {
convert(dt: $dt, tz: $tz)
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "convertTimezone",
"query": "\nquery convertTimezone ($dt: DateTime!, $tz: String) {\n\tconvert(dt: $dt, tz: $tz)\n}\n",
"sourceLocation": "testdata/queries/DateTime.graphql"
}
]
}
-32
View File
@@ -1,32 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
)
// EmptyInterfaceResponse is returned by EmptyInterface on success.
type EmptyInterfaceResponse struct {
GetJunk interface{} `json:"getJunk"`
GetComplexJunk []map[string]*[]*map[string]interface{} `json:"getComplexJunk"`
}
func EmptyInterface(
client graphql.Client,
) (*EmptyInterfaceResponse, error) {
var retval EmptyInterfaceResponse
err := client.MakeRequest(
nil,
"EmptyInterface",
`
query EmptyInterface {
getJunk
getComplexJunk
}
`,
&retval,
nil,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "EmptyInterface",
"query": "\nquery EmptyInterface {\n\tgetJunk\n\tgetComplexJunk\n}\n",
"sourceLocation": "testdata/queries/EmptyInterface.graphql"
}
]
}
-64
View File
@@ -1,64 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// InputEnumQueryResponse is returned by InputEnumQuery on success.
type InputEnumQueryResponse struct {
// usersWithRole looks a user up by role.
UsersWithRole []InputEnumQueryUsersWithRoleUser `json:"usersWithRole"`
}
// InputEnumQueryUsersWithRoleUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type InputEnumQueryUsersWithRoleUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
// Role is a type a user may have.
type Role string
const (
// What is a student?
//
// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
//
// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
RoleStudent Role = "STUDENT"
// Teacher is a teacher, who teaches the students.
RoleTeacher Role = "TEACHER"
)
func InputEnumQuery(
client graphql.Client,
role Role,
) (*InputEnumQueryResponse, error) {
variables := map[string]interface{}{
"role": role,
}
var retval InputEnumQueryResponse
err := client.MakeRequest(
nil,
"InputEnumQuery",
`
query InputEnumQuery ($role: Role!) {
usersWithRole(role: $role) {
id
}
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "InputEnumQuery",
"query": "\nquery InputEnumQuery ($role: Role!) {\n\tusersWithRole(role: $role) {\n\t\tid\n\t}\n}\n",
"sourceLocation": "testdata/queries/InputEnum.graphql"
}
]
}
-81
View File
@@ -1,81 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// InputObjectQueryResponse is returned by InputObjectQuery on success.
type InputObjectQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User InputObjectQueryUser `json:"user"`
}
// InputObjectQueryUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type InputObjectQueryUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
// Role is a type a user may have.
type Role string
const (
// What is a student?
//
// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
//
// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
RoleStudent Role = "STUDENT"
// Teacher is a teacher, who teaches the students.
RoleTeacher Role = "TEACHER"
)
// UserQueryInput is the argument to Query.users.
//
// Ideally this would support anything and everything!
// Or maybe ideally it wouldn't.
// Really I'm just talking to make this documentation longer.
type UserQueryInput struct {
Email string `json:"email"`
Name string `json:"name"`
// id looks the user up by ID. It's a great way to look up users.
Id testutil.ID `json:"id"`
Role Role `json:"role"`
Names []string `json:"names"`
}
func InputObjectQuery(
client graphql.Client,
query UserQueryInput,
) (*InputObjectQueryResponse, error) {
variables := map[string]interface{}{
"query": query,
}
var retval InputObjectQueryResponse
err := client.MakeRequest(
nil,
"InputObjectQuery",
`
query InputObjectQuery ($query: UserQueryInput) {
user(query: $query) {
id
}
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "InputObjectQuery",
"query": "\nquery InputObjectQuery ($query: UserQueryInput) {\n\tuser(query: $query) {\n\t\tid\n\t}\n}\n",
"sourceLocation": "testdata/queries/InputObject.graphql"
}
]
}
-403
View File
@@ -1,403 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"encoding/json"
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// InterfaceNestingResponse is returned by InterfaceNesting on success.
type InterfaceNestingResponse struct {
Root InterfaceNestingRootTopic `json:"root"`
}
// InterfaceNestingRootTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNestingRootTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNestingRootTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNestingRootTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNestingRootTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
}
// InterfaceNestingRootTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type InterfaceNestingRootTopicChildrenArticle struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenArticleParentTopic `json:"parent"`
}
func (v InterfaceNestingRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenArticleParentTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenArticleParentTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopicChildrenArticleParentTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNestingRootTopicChildrenArticleParentTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopicChildrenArticleParentTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
}
// InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent()
}
// InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type InterfaceNestingRootTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent()
}
// InterfaceNestingRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenTopic struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenTopicParentTopic `json:"parent"`
}
func (v InterfaceNestingRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenTopicParentTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenTopicParentTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopicChildrenTopicParentTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNestingRootTopicChildrenTopicParentTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopicChildrenTopicParentTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
}
// InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent()
}
// InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenVideo struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenVideoParentTopic `json:"parent"`
}
func (v InterfaceNestingRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideoParentTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenVideoParentTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopicChildrenVideoParentTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNestingRootTopicChildrenVideoParentTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopicChildrenVideoParentTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
}
// InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent()
}
// InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
func InterfaceNesting(
client graphql.Client,
) (*InterfaceNestingResponse, error) {
var retval InterfaceNestingResponse
err := client.MakeRequest(
nil,
"InterfaceNesting",
`
query InterfaceNesting {
root {
id
children {
id
parent {
id
children {
id
}
}
}
}
}
`,
&retval,
nil,
)
return &retval, err
}
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "InterfaceNesting",
"query": "\nquery InterfaceNesting {\n\troot {\n\t\tid\n\t\tchildren {\n\t\t\tid\n\t\t\tparent {\n\t\t\t\tid\n\t\t\t\tchildren {\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n",
"sourceLocation": "testdata/queries/InterfaceNesting.graphql"
}
]
}
@@ -1,133 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"encoding/json"
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// InterfaceNoFragmentsQueryResponse is returned by InterfaceNoFragmentsQuery on success.
type InterfaceNoFragmentsQueryResponse struct {
Root InterfaceNoFragmentsQueryRootTopic `json:"root"`
}
// InterfaceNoFragmentsQueryRootTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNoFragmentsQueryRootTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Name string `json:"name"`
Children []InterfaceNoFragmentsQueryRootTopicChildrenContent `json:"-"`
}
func (v *InterfaceNoFragmentsQueryRootTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNoFragmentsQueryRootTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNoFragmentsQueryRootTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
}
// InterfaceNoFragmentsQueryRootTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type InterfaceNoFragmentsQueryRootTopicChildrenArticle struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
// InterfaceNoFragmentsQueryRootTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type InterfaceNoFragmentsQueryRootTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent()
}
// InterfaceNoFragmentsQueryRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNoFragmentsQueryRootTopicChildrenTopic struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
// InterfaceNoFragmentsQueryRootTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNoFragmentsQueryRootTopicChildrenVideo struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
func InterfaceNoFragmentsQuery(
client graphql.Client,
) (*InterfaceNoFragmentsQueryResponse, error) {
var retval InterfaceNoFragmentsQueryResponse
err := client.MakeRequest(
nil,
"InterfaceNoFragmentsQuery",
`
query InterfaceNoFragmentsQuery {
root {
id
name
children {
id
name
}
}
}
`,
&retval,
nil,
)
return &retval, err
}
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "InterfaceNoFragmentsQuery",
"query": "\nquery InterfaceNoFragmentsQuery {\n\troot {\n\t\tid\n\t\tname\n\t\tchildren {\n\t\t\tid\n\t\t\tname\n\t\t}\n\t}\n}\n",
"sourceLocation": "testdata/queries/InterfaceNoFragments.graphql"
}
]
}
-53
View File
@@ -1,53 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// ListInputQueryResponse is returned by ListInputQuery on success.
type ListInputQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User ListInputQueryUser `json:"user"`
}
// ListInputQueryUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type ListInputQueryUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
func ListInputQuery(
client graphql.Client,
names []string,
) (*ListInputQueryResponse, error) {
variables := map[string]interface{}{
"names": names,
}
var retval ListInputQueryResponse
err := client.MakeRequest(
nil,
"ListInputQuery",
`
query ListInputQuery ($names: [String]) {
user(query: {names:$names}) {
id
}
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "ListInputQuery",
"query": "\nquery ListInputQuery ($names: [String]) {\n\tuser(query: {names:$names}) {\n\t\tid\n\t}\n}\n",
"sourceLocation": "testdata/queries/ListInput.graphql"
}
]
}
-30
View File
@@ -1,30 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
)
// ListOfListsOfListsResponse is returned by ListOfListsOfLists on success.
type ListOfListsOfListsResponse struct {
ListOfListsOfLists [][][]string `json:"listOfListsOfLists"`
}
func ListOfListsOfLists(
client graphql.Client,
) (*ListOfListsOfListsResponse, error) {
var retval ListOfListsOfListsResponse
err := client.MakeRequest(
nil,
"ListOfListsOfLists",
`
query ListOfListsOfLists {
listOfListsOfLists
}
`,
&retval,
nil,
)
return &retval, err
}
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "ListOfListsOfLists",
"query": "\nquery ListOfListsOfLists {\n\tlistOfListsOfLists\n}\n",
"sourceLocation": "testdata/queries/ListOfListsOfLists.graphql"
}
]
}
-125
View File
@@ -1,125 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"time"
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// OmitEmptyQueryResponse is returned by OmitEmptyQuery on success.
type OmitEmptyQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User OmitEmptyQueryUser `json:"user"`
Users OmitEmptyQueryUsersUser `json:"users"`
MaybeConvert time.Time `json:"maybeConvert"`
Convert2 time.Time `json:"convert2"`
}
// OmitEmptyQueryUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type OmitEmptyQueryUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
// OmitEmptyQueryUsersUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type OmitEmptyQueryUsersUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
// Role is a type a user may have.
type Role string
const (
// What is a student?
//
// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
//
// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
RoleStudent Role = "STUDENT"
// Teacher is a teacher, who teaches the students.
RoleTeacher Role = "TEACHER"
)
// UserQueryInput is the argument to Query.users.
//
// Ideally this would support anything and everything!
// Or maybe ideally it wouldn't.
// Really I'm just talking to make this documentation longer.
type UserQueryInput struct {
Email string `json:"email"`
Name string `json:"name"`
// id looks the user up by ID. It's a great way to look up users.
Id testutil.ID `json:"id"`
Role Role `json:"role"`
Names []string `json:"names"`
}
func OmitEmptyQuery(
client graphql.Client,
query UserQueryInput,
queries []UserQueryInput,
dt time.Time,
tz string,
tzNoOmitEmpty string,
) (*OmitEmptyQueryResponse, error) {
variables := map[string]interface{}{
"tzNoOmitEmpty": tzNoOmitEmpty,
}
var zero_query UserQueryInput
if query != zero_query {
variables["query"] = query
}
if len(queries) > 0 {
variables["queries"] = queries
}
var zero_dt time.Time
if dt != zero_dt {
variables["dt"] = dt
}
var zero_tz string
if tz != zero_tz {
variables["tz"] = tz
}
var retval OmitEmptyQueryResponse
err := client.MakeRequest(
nil,
"OmitEmptyQuery",
`
query OmitEmptyQuery ($query: UserQueryInput, $queries: [UserQueryInput], $dt: DateTime, $tz: String, $tzNoOmitEmpty: String) {
user(query: $query) {
id
}
users(query: $queries) {
id
}
maybeConvert(dt: $dt, tz: $tz)
convert2: maybeConvert(dt: $dt, tz: $tzNoOmitEmpty)
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "OmitEmptyQuery",
"query": "\nquery OmitEmptyQuery ($query: UserQueryInput, $queries: [UserQueryInput], $dt: DateTime, $tz: String, $tzNoOmitEmpty: String) {\n\tuser(query: $query) {\n\t\tid\n\t}\n\tusers(query: $queries) {\n\t\tid\n\t}\n\tmaybeConvert(dt: $dt, tz: $tz)\n\tconvert2: maybeConvert(dt: $dt, tz: $tzNoOmitEmpty)\n}\n",
"sourceLocation": "testdata/queries/Omitempty.graphql"
}
]
}
-116
View File
@@ -1,116 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"time"
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// PointersQueryOtherUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type PointersQueryOtherUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id *testutil.ID `json:"id"`
}
// PointersQueryResponse is returned by PointersQuery on success.
type PointersQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User *PointersQueryUser `json:"user"`
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
OtherUser *PointersQueryOtherUser `json:"otherUser"`
MaybeConvert *time.Time `json:"maybeConvert"`
}
// PointersQueryUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type PointersQueryUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id *testutil.ID `json:"id"`
Roles []*Role `json:"roles"`
Name *string `json:"name"`
Emails []*string `json:"emails"`
EmailsNoPtr []string `json:"emailsNoPtr"`
}
// Role is a type a user may have.
type Role string
const (
// What is a student?
//
// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
//
// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
RoleStudent Role = "STUDENT"
// Teacher is a teacher, who teaches the students.
RoleTeacher Role = "TEACHER"
)
// UserQueryInput is the argument to Query.users.
//
// Ideally this would support anything and everything!
// Or maybe ideally it wouldn't.
// Really I'm just talking to make this documentation longer.
type UserQueryInput struct {
Email *string `json:"email"`
Name *string `json:"name"`
// id looks the user up by ID. It's a great way to look up users.
Id *testutil.ID `json:"id"`
Role *Role `json:"role"`
Names []*string `json:"names"`
}
func PointersQuery(
client graphql.Client,
query UserQueryInput,
dt time.Time,
tz string,
) (*PointersQueryResponse, error) {
variables := map[string]interface{}{
"query": query,
"dt": dt,
"tz": tz,
}
var retval PointersQueryResponse
err := client.MakeRequest(
nil,
"PointersQuery",
`
query PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) {
user(query: $query) {
id
roles
name
emails
emailsNoPtr: emails
}
otherUser: user(query: $query) {
id
}
maybeConvert(dt: $dt, tz: $tz)
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "PointersQuery",
"query": "\nquery PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) {\n\tuser(query: $query) {\n\t\tid\n\t\troles\n\t\tname\n\t\temails\n\t\temailsNoPtr: emails\n\t}\n\totherUser: user(query: $query) {\n\t\tid\n\t}\n\tmaybeConvert(dt: $dt, tz: $tz)\n}\n",
"sourceLocation": "testdata/queries/Pointers.graphql"
}
]
}
-116
View File
@@ -1,116 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"time"
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// PointersQueryOtherUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type PointersQueryOtherUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
// PointersQueryResponse is returned by PointersQuery on success.
type PointersQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User *PointersQueryUser `json:"user"`
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
OtherUser *PointersQueryOtherUser `json:"otherUser"`
MaybeConvert time.Time `json:"maybeConvert"`
}
// PointersQueryUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type PointersQueryUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
Roles []Role `json:"roles"`
Name *string `json:"name"`
Emails []*string `json:"emails"`
EmailsNoPtr []*string `json:"emailsNoPtr"`
}
// Role is a type a user may have.
type Role string
const (
// What is a student?
//
// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
//
// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
RoleStudent Role = "STUDENT"
// Teacher is a teacher, who teaches the students.
RoleTeacher Role = "TEACHER"
)
// UserQueryInput is the argument to Query.users.
//
// Ideally this would support anything and everything!
// Or maybe ideally it wouldn't.
// Really I'm just talking to make this documentation longer.
type UserQueryInput struct {
Email string `json:"email"`
Name string `json:"name"`
// id looks the user up by ID. It's a great way to look up users.
Id testutil.ID `json:"id"`
Role Role `json:"role"`
Names []string `json:"names"`
}
func PointersQuery(
client graphql.Client,
query *UserQueryInput,
dt *time.Time,
tz string,
) (*PointersQueryResponse, error) {
variables := map[string]interface{}{
"query": query,
"dt": dt,
"tz": tz,
}
var retval PointersQueryResponse
err := client.MakeRequest(
nil,
"PointersQuery",
`
query PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) {
user(query: $query) {
id
roles
name
emails
emailsNoPtr: emails
}
otherUser: user(query: $query) {
id
}
maybeConvert(dt: $dt, tz: $tz)
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "PointersQuery",
"query": "\nquery PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) {\n\tuser(query: $query) {\n\t\tid\n\t\troles\n\t\tname\n\t\temails\n\t\temailsNoPtr: emails\n\t}\n\totherUser: user(query: $query) {\n\t\tid\n\t}\n\tmaybeConvert(dt: $dt, tz: $tz)\n}\n",
"sourceLocation": "testdata/queries/PointersInline.graphql"
}
]
}
-53
View File
@@ -1,53 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// QueryWithAliasResponse is returned by QueryWithAlias on success.
type QueryWithAliasResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User QueryWithAliasUser `json:"User"`
}
// QueryWithAliasUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type QueryWithAliasUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
ID testutil.ID `json:"ID"`
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
OtherID testutil.ID `json:"otherID"`
}
func QueryWithAlias(
client graphql.Client,
) (*QueryWithAliasResponse, error) {
var retval QueryWithAliasResponse
err := client.MakeRequest(
nil,
"QueryWithAlias",
`
query QueryWithAlias {
User: user {
ID: id
otherID: id
}
}
`,
&retval,
nil,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "QueryWithAlias",
"query": "\nquery QueryWithAlias {\n\tUser: user {\n\t\tID: id\n\t\totherID: id\n\t}\n}\n",
"sourceLocation": "testdata/queries/QueryWithAlias.graphql"
}
]
}
@@ -1,53 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// QueryWithDoubleAliasResponse is returned by QueryWithDoubleAlias on success.
type QueryWithDoubleAliasResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User QueryWithDoubleAliasUser `json:"user"`
}
// QueryWithDoubleAliasUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type QueryWithDoubleAliasUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
ID testutil.ID `json:"ID"`
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
AlsoID testutil.ID `json:"AlsoID"`
}
func QueryWithDoubleAlias(
client graphql.Client,
) (*QueryWithDoubleAliasResponse, error) {
var retval QueryWithDoubleAliasResponse
err := client.MakeRequest(
nil,
"QueryWithDoubleAlias",
`
query QueryWithDoubleAlias {
user {
ID: id
AlsoID: id
}
}
`,
&retval,
nil,
)
return &retval, err
}
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "QueryWithDoubleAlias",
"query": "\nquery QueryWithDoubleAlias {\n\tuser {\n\t\tID: id\n\t\tAlsoID: id\n\t}\n}\n",
"sourceLocation": "testdata/queries/QueryWithDoubleAlias.graphql"
}
]
}
-74
View File
@@ -1,74 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
)
// QueryWithEnumsOtherUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type QueryWithEnumsOtherUser struct {
Roles []Role `json:"roles"`
}
// QueryWithEnumsResponse is returned by QueryWithEnums on success.
type QueryWithEnumsResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User QueryWithEnumsUser `json:"user"`
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
OtherUser QueryWithEnumsOtherUser `json:"otherUser"`
}
// QueryWithEnumsUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type QueryWithEnumsUser struct {
Roles []Role `json:"roles"`
}
// Role is a type a user may have.
type Role string
const (
// What is a student?
//
// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
//
// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
RoleStudent Role = "STUDENT"
// Teacher is a teacher, who teaches the students.
RoleTeacher Role = "TEACHER"
)
func QueryWithEnums(
client graphql.Client,
) (*QueryWithEnumsResponse, error) {
var retval QueryWithEnumsResponse
err := client.MakeRequest(
nil,
"QueryWithEnums",
`
query QueryWithEnums {
user {
roles
}
otherUser: user {
roles
}
}
`,
&retval,
nil,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "QueryWithEnums",
"query": "\nquery QueryWithEnums {\n\tuser {\n\t\troles\n\t}\n\totherUser: user {\n\t\troles\n\t}\n}\n",
"sourceLocation": "testdata/queries/QueryWithEnums.graphql"
}
]
}
-50
View File
@@ -1,50 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
)
// QueryWithSlicesResponse is returned by QueryWithSlices on success.
type QueryWithSlicesResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User QueryWithSlicesUser `json:"user"`
}
// QueryWithSlicesUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type QueryWithSlicesUser struct {
Emails []string `json:"emails"`
EmailsOrNull []string `json:"emailsOrNull"`
EmailsWithNulls []string `json:"emailsWithNulls"`
EmailsWithNullsOrNull []string `json:"emailsWithNullsOrNull"`
}
func QueryWithSlices(
client graphql.Client,
) (*QueryWithSlicesResponse, error) {
var retval QueryWithSlicesResponse
err := client.MakeRequest(
nil,
"QueryWithSlices",
`
query QueryWithSlices {
user {
emails
emailsOrNull
emailsWithNulls
emailsWithNullsOrNull
}
}
`,
&retval,
nil,
)
return &retval, err
}
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "QueryWithSlices",
"query": "\nquery QueryWithSlices {\n\tuser {\n\t\temails\n\t\temailsOrNull\n\t\temailsWithNulls\n\t\temailsWithNullsOrNull\n\t}\n}\n",
"sourceLocation": "testdata/queries/QueryWithSlices.graphql"
}
]
}
-53
View File
@@ -1,53 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
)
// QueryWithStructsResponse is returned by QueryWithStructs on success.
type QueryWithStructsResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User QueryWithStructsUser `json:"user"`
}
// QueryWithStructsUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type QueryWithStructsUser struct {
AuthMethods []QueryWithStructsUserAuthMethodsAuthMethod `json:"authMethods"`
}
// QueryWithStructsUserAuthMethodsAuthMethod includes the requested fields of the GraphQL type AuthMethod.
type QueryWithStructsUserAuthMethodsAuthMethod struct {
Provider string `json:"provider"`
Email string `json:"email"`
}
func QueryWithStructs(
client graphql.Client,
) (*QueryWithStructsResponse, error) {
var retval QueryWithStructsResponse
err := client.MakeRequest(
nil,
"QueryWithStructs",
`
query QueryWithStructs {
user {
authMethods {
provider
email
}
}
}
`,
&retval,
nil,
)
return &retval, err
}
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "QueryWithStructs",
"query": "\nquery QueryWithStructs {\n\tuser {\n\t\tauthMethods {\n\t\t\tprovider\n\t\t\temail\n\t\t}\n\t}\n}\n",
"sourceLocation": "testdata/queries/QueryWithStructs.graphql"
}
]
}
-53
View File
@@ -1,53 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// SimpleInputQueryResponse is returned by SimpleInputQuery on success.
type SimpleInputQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User SimpleInputQueryUser `json:"user"`
}
// SimpleInputQueryUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type SimpleInputQueryUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
func SimpleInputQuery(
client graphql.Client,
name string,
) (*SimpleInputQueryResponse, error) {
variables := map[string]interface{}{
"name": name,
}
var retval SimpleInputQueryResponse
err := client.MakeRequest(
nil,
"SimpleInputQuery",
`
query SimpleInputQuery ($name: String!) {
user(query: {name:$name}) {
id
}
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "SimpleInputQuery",
"query": "\nquery SimpleInputQuery ($name: String!) {\n\tuser(query: {name:$name}) {\n\t\tid\n\t}\n}\n",
"sourceLocation": "testdata/queries/SimpleInput.graphql"
}
]
}
-55
View File
@@ -1,55 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// SimpleMutationCreateUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type SimpleMutationCreateUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// SimpleMutationResponse is returned by SimpleMutation on success.
type SimpleMutationResponse struct {
CreateUser SimpleMutationCreateUser `json:"createUser"`
}
// SimpleMutation creates a user.
//
// It has a long doc-comment, to test that we handle that correctly.
// What a long comment indeed.
func SimpleMutation(
client graphql.Client,
name string,
) (*SimpleMutationResponse, error) {
variables := map[string]interface{}{
"name": name,
}
var retval SimpleMutationResponse
err := client.MakeRequest(
nil,
"SimpleMutation",
`
mutation SimpleMutation ($name: String!) {
createUser(name: $name) {
id
name
}
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "SimpleMutation",
"query": "\nmutation SimpleMutation ($name: String!) {\n\tcreateUser(name: $name) {\n\t\tid\n\t\tname\n\t}\n}\n",
"sourceLocation": "testdata/queries/SimpleMutation.graphql"
}
]
}
-48
View File
@@ -1,48 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// SimpleQueryResponse is returned by SimpleQuery on success.
type SimpleQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User SimpleQueryUser `json:"user"`
}
// SimpleQueryUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type SimpleQueryUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
func SimpleQuery(
client graphql.Client,
) (*SimpleQueryResponse, error) {
var retval SimpleQueryResponse
err := client.MakeRequest(
nil,
"SimpleQuery",
`
query SimpleQuery {
user {
id
}
}
`,
&retval,
nil,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "SimpleQuery",
"query": "\nquery SimpleQuery {\n\tuser {\n\t\tid\n\t}\n}\n",
"sourceLocation": "testdata/queries/SimpleQuery.graphql"
}
]
}
-50
View File
@@ -1,50 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// TypeNameQueryResponse is returned by TypeNameQuery on success.
type TypeNameQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User TypeNameQueryUser `json:"user"`
}
// TypeNameQueryUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type TypeNameQueryUser struct {
Typename string `json:"__typename"`
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
func TypeNameQuery(
client graphql.Client,
) (*TypeNameQueryResponse, error) {
var retval TypeNameQueryResponse
err := client.MakeRequest(
nil,
"TypeNameQuery",
`
query TypeNameQuery {
user {
__typename
id
}
}
`,
&retval,
nil,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "TypeNameQuery",
"query": "\nquery TypeNameQuery {\n\tuser {\n\t\t__typename\n\t\tid\n\t}\n}\n",
"sourceLocation": "testdata/queries/TypeName.graphql"
}
]
}
-99
View File
@@ -1,99 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"encoding/json"
"github.com/Khan/genqlient/graphql"
)
// UnionNoFragmentsQueryRandomLeafArticle includes the requested fields of the GraphQL type Article.
type UnionNoFragmentsQueryRandomLeafArticle struct {
Typename string `json:"__typename"`
}
func (v UnionNoFragmentsQueryRandomLeafArticle) implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent() {
}
// UnionNoFragmentsQueryRandomLeafLeafContent includes the requested fields of the GraphQL type LeafContent.
// The GraphQL type's documentation follows.
//
// LeafContent represents content items that can't have child-nodes.
type UnionNoFragmentsQueryRandomLeafLeafContent interface {
implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent()
}
// UnionNoFragmentsQueryRandomLeafVideo includes the requested fields of the GraphQL type Video.
type UnionNoFragmentsQueryRandomLeafVideo struct {
Typename string `json:"__typename"`
}
func (v UnionNoFragmentsQueryRandomLeafVideo) implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent() {
}
// UnionNoFragmentsQueryResponse is returned by UnionNoFragmentsQuery on success.
type UnionNoFragmentsQueryResponse struct {
RandomLeaf UnionNoFragmentsQueryRandomLeafLeafContent `json:"-"`
}
func (v *UnionNoFragmentsQueryResponse) UnmarshalJSON(b []byte) error {
var firstPass struct {
*UnionNoFragmentsQueryResponse
RandomLeaf json.RawMessage `json:"randomLeaf"`
}
firstPass.UnionNoFragmentsQueryResponse = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.RandomLeaf, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.RandomLeaf = UnionNoFragmentsQueryRandomLeafArticle{}
err = json.Unmarshal(
firstPass.RandomLeaf, &v.RandomLeaf)
case "Video":
v.RandomLeaf = UnionNoFragmentsQueryRandomLeafVideo{}
err = json.Unmarshal(
firstPass.RandomLeaf, &v.RandomLeaf)
}
if err != nil {
return err
}
return nil
}
func UnionNoFragmentsQuery(
client graphql.Client,
) (*UnionNoFragmentsQueryResponse, error) {
var retval UnionNoFragmentsQueryResponse
err := client.MakeRequest(
nil,
"UnionNoFragmentsQuery",
`
query UnionNoFragmentsQuery {
randomLeaf {
__typename
}
}
`,
&retval,
nil,
)
return &retval, err
}
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "UnionNoFragmentsQuery",
"query": "\nquery UnionNoFragmentsQuery {\n\trandomLeaf {\n\t\t__typename\n\t}\n}\n",
"sourceLocation": "testdata/queries/UnionNoFragments.graphql"
}
]
}
-74
View File
@@ -1,74 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
)
// Role is a type a user may have.
type Role string
const (
// What is a student?
//
// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
//
// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
RoleStudent Role = "STUDENT"
// Teacher is a teacher, who teaches the students.
RoleTeacher Role = "TEACHER"
)
// UsesEnumTwiceQueryMeUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type UsesEnumTwiceQueryMeUser struct {
Roles []Role `json:"roles"`
}
// UsesEnumTwiceQueryOtherUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type UsesEnumTwiceQueryOtherUser struct {
Roles []Role `json:"roles"`
}
// UsesEnumTwiceQueryResponse is returned by UsesEnumTwiceQuery on success.
type UsesEnumTwiceQueryResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
Me UsesEnumTwiceQueryMeUser `json:"Me"`
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
OtherUser UsesEnumTwiceQueryOtherUser `json:"OtherUser"`
}
func UsesEnumTwiceQuery(
client graphql.Client,
) (*UsesEnumTwiceQueryResponse, error) {
var retval UsesEnumTwiceQueryResponse
err := client.MakeRequest(
nil,
"UsesEnumTwiceQuery",
`
query UsesEnumTwiceQuery {
Me: user {
roles
}
OtherUser: user {
roles
}
}
`,
&retval,
nil,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "UsesEnumTwiceQuery",
"query": "\nquery UsesEnumTwiceQuery {\n\tMe: user {\n\t\troles\n\t}\n\tOtherUser: user {\n\t\troles\n\t}\n}\n",
"sourceLocation": "testdata/queries/UsesEnumTwice.graphql"
}
]
}
-81
View File
@@ -1,81 +0,0 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// Role is a type a user may have.
type Role string
const (
// What is a student?
//
// A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
//
// (from [Wikipedia](https://en.wikipedia.org/wiki/Student))
RoleStudent Role = "STUDENT"
// Teacher is a teacher, who teaches the students.
RoleTeacher Role = "TEACHER"
)
// unexportedResponse is returned by unexported on success.
type unexportedResponse struct {
// user looks up a user by some stuff.
//
// See UserQueryInput for what stuff is supported.
// If query is null, returns the current user.
User unexportedUser `json:"user"`
}
// unexportedUser includes the requested fields of the GraphQL type User.
// The GraphQL type's documentation follows.
//
// A User is a user!
type unexportedUser struct {
// id is the user's ID.
//
// It is stable, unique, and opaque, like all good IDs.
Id testutil.ID `json:"id"`
}
// UserQueryInput is the argument to Query.users.
//
// Ideally this would support anything and everything!
// Or maybe ideally it wouldn't.
// Really I'm just talking to make this documentation longer.
type userQueryInput struct {
Email string `json:"email"`
Name string `json:"name"`
// id looks the user up by ID. It's a great way to look up users.
Id testutil.ID `json:"id"`
Role Role `json:"role"`
Names []string `json:"names"`
}
func unexported(
client graphql.Client,
query userQueryInput,
) (*unexportedResponse, error) {
variables := map[string]interface{}{
"query": query,
}
var retval unexportedResponse
err := client.MakeRequest(
nil,
"unexported",
`
query unexported ($query: UserQueryInput) {
user(query: $query) {
id
}
}
`,
&retval,
variables,
)
return &retval, err
}
-9
View File
@@ -1,9 +0,0 @@
{
"operations": [
{
"operationName": "unexported",
"query": "\nquery unexported ($query: UserQueryInput) {\n\tuser(query: $query) {\n\t\tid\n\t}\n}\n",
"sourceLocation": "testdata/queries/unexported.graphql"
}
]
}