Expose the graphql operation as a constant in the generated genqlient file (#238)

This allows client code to see the operation (query or mutation) exactly
as genqlient sends it over the wire. This data was already available in
the generated safelist.json file, but now it's easily available from Go
code as well.
    
Fixes #236

I have:
- [x] Written a clear PR title and description (above)
- [x] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla)
- [x] Added tests covering my changes, if applicable
- [x] Included a link to the issue fixed, if applicable
- [x] Included documentation, for new features
- [x] Added an entry to the changelog
This commit is contained in:
Craig Silverstein
2022-11-21 08:35:09 -08:00
committed by GitHub
parent 00f27609f0
commit 587f77046b
58 changed files with 779 additions and 556 deletions
+4 -1
View File
@@ -1,3 +1,6 @@
// The query or mutation executed by {{.Name}}.
const {{.Name}}Operation = `{{$.Body}}`
{{.Doc}}
func {{.Name}}(
{{if ne .Config.ContextType "-" -}}
@@ -15,7 +18,7 @@ func {{.Name}}(
) (*{{.ResponseName}}, {{if .Config.Extensions -}}map[string]interface{},{{end}} error) {
req := &graphql.Request{
OpName: "{{.Name}}",
Query: `{{.Body}}`,
Query: {{.Name}}Operation,
{{if .Input -}}
Variables: &{{.Input.GoName}}{
{{range .Input.Fields -}}
@@ -1340,17 +1340,8 @@ func (v *ComplexInlineFragmentsRootTopic) GetSchoolGrade() string { return v.Sch
// GetName returns ComplexInlineFragmentsRootTopic.Name, and is useful for accessing the field via an interface.
func (v *ComplexInlineFragmentsRootTopic) GetName() string { return v.Name }
// We test all the spread cases from docs/DESIGN.md, see there for more context
// on each, as well as various other nonsense. But for abstract-in-abstract
// spreads, we can't test cases (4b) and (4c), where I implements J or vice
// versa, because gqlparser doesn't support interfaces that implement other
// interfaces yet.
func ComplexInlineFragments(
client graphql.Client,
) (*ComplexInlineFragmentsResponse, error) {
req := &graphql.Request{
OpName: "ComplexInlineFragments",
Query: `
// The query or mutation executed by ComplexInlineFragments.
const ComplexInlineFragmentsOperation = `
query ComplexInlineFragments {
root {
id
@@ -1436,7 +1427,19 @@ query ComplexInlineFragments {
}
}
}
`,
`
// We test all the spread cases from docs/DESIGN.md, see there for more context
// on each, as well as various other nonsense. But for abstract-in-abstract
// spreads, we can't test cases (4b) and (4c), where I implements J or vice
// versa, because gqlparser doesn't support interfaces that implement other
// interfaces yet.
func ComplexInlineFragments(
client graphql.Client,
) (*ComplexInlineFragmentsResponse, error) {
req := &graphql.Request{
OpName: "ComplexInlineFragments",
Query: ComplexInlineFragmentsOperation,
}
var err error
@@ -1739,12 +1739,8 @@ type VideoFieldsThumbnail struct {
// GetId returns VideoFieldsThumbnail.Id, and is useful for accessing the field via an interface.
func (v *VideoFieldsThumbnail) GetId() testutil.ID { return v.Id }
func ComplexNamedFragments(
client graphql.Client,
) (*ComplexNamedFragmentsResponse, error) {
req := &graphql.Request{
OpName: "ComplexNamedFragments",
Query: `
// The query or mutation executed by ComplexNamedFragments.
const ComplexNamedFragmentsOperation = `
query ComplexNamedFragments {
... on Query {
... QueryFragment
@@ -1802,7 +1798,14 @@ fragment MoreVideoFields on Video {
}
}
}
`,
`
func ComplexNamedFragments(
client graphql.Client,
) (*ComplexNamedFragmentsResponse, error) {
req := &graphql.Request{
OpName: "ComplexNamedFragments",
Query: ComplexNamedFragmentsOperation,
}
var err error
@@ -2346,12 +2346,8 @@ type TopicFieldsRelatedTopic struct {
// GetId returns TopicFieldsRelatedTopic.Id, and is useful for accessing the field via an interface.
func (v *TopicFieldsRelatedTopic) GetId() testutil.ID { return v.Id }
func CovariantInterfaceImplementation(
client graphql.Client,
) (*CovariantInterfaceImplementationResponse, error) {
req := &graphql.Request{
OpName: "CovariantInterfaceImplementation",
Query: `
// The query or mutation executed by CovariantInterfaceImplementation.
const CovariantInterfaceImplementationOperation = `
query CovariantInterfaceImplementation {
randomItem {
__typename
@@ -2394,7 +2390,14 @@ fragment TopicFields on Topic {
id
}
}
`,
`
func CovariantInterfaceImplementation(
client graphql.Client,
) (*CovariantInterfaceImplementationResponse, error) {
req := &graphql.Request{
OpName: "CovariantInterfaceImplementation",
Query: CovariantInterfaceImplementationOperation,
}
var err error
@@ -174,20 +174,23 @@ func (v *__CustomMarshalInput) __premarshalJSON() (*__premarshal__CustomMarshalI
return &retval, nil
}
func CustomMarshal(
client graphql.Client,
date time.Time,
) (*CustomMarshalResponse, error) {
req := &graphql.Request{
OpName: "CustomMarshal",
Query: `
// The query or mutation executed by CustomMarshal.
const CustomMarshalOperation = `
query CustomMarshal ($date: Date!) {
usersBornOn(date: $date) {
id
birthdate
}
}
`,
`
func CustomMarshal(
client graphql.Client,
date time.Time,
) (*CustomMarshalResponse, error) {
req := &graphql.Request{
OpName: "CustomMarshal",
Query: CustomMarshalOperation,
Variables: &__CustomMarshalInput{
Date: date,
},
@@ -203,6 +203,14 @@ func (v *__CustomMarshalSliceInput) __premarshalJSON() (*__premarshal__CustomMar
return &retval, nil
}
// The query or mutation executed by CustomMarshalSlice.
const CustomMarshalSliceOperation = `
query CustomMarshalSlice ($datesss: [[[Date!]!]!]!, $datesssp: [[[Date!]!]!]!) {
acceptsListOfListOfListsOfDates(datesss: $datesss)
withPointer: acceptsListOfListOfListsOfDates(datesss: $datesssp)
}
`
func CustomMarshalSlice(
client graphql.Client,
datesss [][][]time.Time,
@@ -210,12 +218,7 @@ func CustomMarshalSlice(
) (*CustomMarshalSliceResponse, error) {
req := &graphql.Request{
OpName: "CustomMarshalSlice",
Query: `
query CustomMarshalSlice ($datesss: [[[Date!]!]!]!, $datesssp: [[[Date!]!]!]!) {
acceptsListOfListOfListsOfDates(datesss: $datesss)
withPointer: acceptsListOfListOfListsOfDates(datesss: $datesssp)
}
`,
Query: CustomMarshalSliceOperation,
Variables: &__CustomMarshalSliceInput{
Datesss: datesss,
Datesssp: datesssp,
@@ -28,6 +28,13 @@ type convertTimezoneResponse struct {
// GetConvert returns convertTimezoneResponse.Convert, and is useful for accessing the field via an interface.
func (v *convertTimezoneResponse) GetConvert() time.Time { return v.Convert }
// The query or mutation executed by convertTimezone.
const convertTimezoneOperation = `
query convertTimezone ($dt: DateTime!, $tz: String) {
convert(dt: $dt, tz: $tz)
}
`
func convertTimezone(
client graphql.Client,
dt time.Time,
@@ -35,11 +42,7 @@ func convertTimezone(
) (*convertTimezoneResponse, error) {
req := &graphql.Request{
OpName: "convertTimezone",
Query: `
query convertTimezone ($dt: DateTime!, $tz: String) {
convert(dt: $dt, tz: $tz)
}
`,
Query: convertTimezoneOperation,
Variables: &__convertTimezoneInput{
Dt: dt,
Tz: tz,
@@ -20,17 +20,20 @@ func (v *EmptyInterfaceResponse) GetGetComplexJunk() []map[string]*[]*map[string
return v.GetComplexJunk
}
// The query or mutation executed by EmptyInterface.
const EmptyInterfaceOperation = `
query EmptyInterface {
getJunk
getComplexJunk
}
`
func EmptyInterface(
client graphql.Client,
) (*EmptyInterfaceResponse, error) {
req := &graphql.Request{
OpName: "EmptyInterface",
Query: `
query EmptyInterface {
getJunk
getComplexJunk
}
`,
Query: EmptyInterfaceOperation,
}
var err error
@@ -266,12 +266,8 @@ type VideoFieldsParentTopic struct {
// GetVideoChildren returns VideoFieldsParentTopic.VideoChildren, and is useful for accessing the field via an interface.
func (v *VideoFieldsParentTopic) GetVideoChildren() []ChildVideoFields { return v.VideoChildren }
func ComplexNamedFragments(
client graphql.Client,
) (*InnerQueryFragment, error) {
req := &graphql.Request{
OpName: "ComplexNamedFragments",
Query: `
// The query or mutation executed by ComplexNamedFragments.
const ComplexNamedFragmentsOperation = `
query ComplexNamedFragments {
... QueryFragment
}
@@ -306,7 +302,14 @@ fragment ChildVideoFields on Video {
id
name
}
`,
`
func ComplexNamedFragments(
client graphql.Client,
) (*InnerQueryFragment, error) {
req := &graphql.Request{
OpName: "ComplexNamedFragments",
Query: ComplexNamedFragmentsOperation,
}
var err error
@@ -54,19 +54,22 @@ type __InputEnumQueryInput struct {
// GetRole returns __InputEnumQueryInput.Role, and is useful for accessing the field via an interface.
func (v *__InputEnumQueryInput) GetRole() Role { return v.Role }
// The query or mutation executed by InputEnumQuery.
const InputEnumQueryOperation = `
query InputEnumQuery ($role: Role!) {
usersWithRole(role: $role) {
id
}
}
`
func InputEnumQuery(
client graphql.Client,
role Role,
) (*InputEnumQueryResponse, error) {
req := &graphql.Request{
OpName: "InputEnumQuery",
Query: `
query InputEnumQuery ($role: Role!) {
usersWithRole(role: $role) {
id
}
}
`,
Query: InputEnumQueryOperation,
Variables: &__InputEnumQueryInput{
Role: role,
},
@@ -177,19 +177,22 @@ type __InputObjectQueryInput struct {
// GetQuery returns __InputObjectQueryInput.Query, and is useful for accessing the field via an interface.
func (v *__InputObjectQueryInput) GetQuery() UserQueryInput { return v.Query }
// The query or mutation executed by InputObjectQuery.
const InputObjectQueryOperation = `
query InputObjectQuery ($query: UserQueryInput) {
user(query: $query) {
id
}
}
`
func InputObjectQuery(
client graphql.Client,
query UserQueryInput,
) (*InputObjectQueryResponse, error) {
req := &graphql.Request{
OpName: "InputObjectQuery",
Query: `
query InputObjectQuery ($query: UserQueryInput) {
user(query: $query) {
id
}
}
`,
Query: InputObjectQueryOperation,
Variables: &__InputObjectQueryInput{
Query: query,
},
@@ -520,12 +520,8 @@ func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetId() testutil.ID {
// GetName returns InterfaceListFieldWithPointerTopicChildrenVideo.Name, and is useful for accessing the field via an interface.
func (v *InterfaceListFieldWithPointerTopicChildrenVideo) GetName() string { return v.Name }
func InterfaceListField(
client graphql.Client,
) (*InterfaceListFieldResponse, error) {
req := &graphql.Request{
OpName: "InterfaceListField",
Query: `
// The query or mutation executed by InterfaceListField.
const InterfaceListFieldOperation = `
query InterfaceListField {
root {
id
@@ -546,7 +542,14 @@ query InterfaceListField {
}
}
}
`,
`
func InterfaceListField(
client graphql.Client,
) (*InterfaceListFieldResponse, error) {
req := &graphql.Request{
OpName: "InterfaceListField",
Query: InterfaceListFieldOperation,
}
var err error
@@ -506,12 +506,8 @@ func (v *InterfaceListOfListOfListsFieldWithPointerVideo) GetId() *testutil.ID {
// GetName returns InterfaceListOfListOfListsFieldWithPointerVideo.Name, and is useful for accessing the field via an interface.
func (v *InterfaceListOfListOfListsFieldWithPointerVideo) GetName() *string { return v.Name }
func InterfaceListOfListOfListsField(
client graphql.Client,
) (*InterfaceListOfListOfListsFieldResponse, error) {
req := &graphql.Request{
OpName: "InterfaceListOfListOfListsField",
Query: `
// The query or mutation executed by InterfaceListOfListOfListsField.
const InterfaceListOfListOfListsFieldOperation = `
query InterfaceListOfListOfListsField {
listOfListsOfListsOfContent {
__typename
@@ -524,7 +520,14 @@ query InterfaceListOfListOfListsField {
name
}
}
`,
`
func InterfaceListOfListOfListsField(
client graphql.Client,
) (*InterfaceListOfListOfListsFieldResponse, error) {
req := &graphql.Request{
OpName: "InterfaceListOfListOfListsField",
Query: InterfaceListOfListOfListsFieldOperation,
}
var err error
@@ -504,12 +504,8 @@ func (v *InterfaceNestingRootTopicChildrenVideo) GetParent() InterfaceNestingRoo
return v.Parent
}
func InterfaceNesting(
client graphql.Client,
) (*InterfaceNestingResponse, error) {
req := &graphql.Request{
OpName: "InterfaceNesting",
Query: `
// The query or mutation executed by InterfaceNesting.
const InterfaceNestingOperation = `
query InterfaceNesting {
root {
id
@@ -526,7 +522,14 @@ query InterfaceNesting {
}
}
}
`,
`
func InterfaceNesting(
client graphql.Client,
) (*InterfaceNestingResponse, error) {
req := &graphql.Request{
OpName: "InterfaceNesting",
Query: InterfaceNestingOperation,
}
var err error
@@ -626,12 +626,8 @@ func (v *InterfaceNoFragmentsQueryWithPointerVideo) GetId() *testutil.ID { retur
// GetName returns InterfaceNoFragmentsQueryWithPointerVideo.Name, and is useful for accessing the field via an interface.
func (v *InterfaceNoFragmentsQueryWithPointerVideo) GetName() *string { return v.Name }
func InterfaceNoFragmentsQuery(
client graphql.Client,
) (*InterfaceNoFragmentsQueryResponse, error) {
req := &graphql.Request{
OpName: "InterfaceNoFragmentsQuery",
Query: `
// The query or mutation executed by InterfaceNoFragmentsQuery.
const InterfaceNoFragmentsQueryOperation = `
query InterfaceNoFragmentsQuery {
root {
id
@@ -653,7 +649,14 @@ query InterfaceNoFragmentsQuery {
name
}
}
`,
`
func InterfaceNoFragmentsQuery(
client graphql.Client,
) (*InterfaceNoFragmentsQueryResponse, error) {
req := &graphql.Request{
OpName: "InterfaceNoFragmentsQuery",
Query: InterfaceNoFragmentsQueryOperation,
}
var err error
@@ -41,19 +41,22 @@ type __ListInputQueryInput struct {
// GetNames returns __ListInputQueryInput.Names, and is useful for accessing the field via an interface.
func (v *__ListInputQueryInput) GetNames() []string { return v.Names }
// The query or mutation executed by ListInputQuery.
const ListInputQueryOperation = `
query ListInputQuery ($names: [String]) {
user(query: {names:$names}) {
id
}
}
`
func ListInputQuery(
client graphql.Client,
names []string,
) (*ListInputQueryResponse, error) {
req := &graphql.Request{
OpName: "ListInputQuery",
Query: `
query ListInputQuery ($names: [String]) {
user(query: {names:$names}) {
id
}
}
`,
Query: ListInputQueryOperation,
Variables: &__ListInputQueryInput{
Names: names,
},
@@ -16,16 +16,19 @@ func (v *ListOfListsOfListsResponse) GetListOfListsOfLists() [][][]string {
return v.ListOfListsOfLists
}
// The query or mutation executed by ListOfListsOfLists.
const ListOfListsOfListsOperation = `
query ListOfListsOfLists {
listOfListsOfLists
}
`
func ListOfListsOfLists(
client graphql.Client,
) (*ListOfListsOfListsResponse, error) {
req := &graphql.Request{
OpName: "ListOfListsOfLists",
Query: `
query ListOfListsOfLists {
listOfListsOfLists
}
`,
Query: ListOfListsOfListsOperation,
}
var err error
@@ -325,14 +325,8 @@ func (v *__MultipleDirectivesInput) GetQuery() MyInput { return v.Query }
// GetQueries returns __MultipleDirectivesInput.Queries, and is useful for accessing the field via an interface.
func (v *__MultipleDirectivesInput) GetQueries() []*UserQueryInput { return v.Queries }
func MultipleDirectives(
client graphql.Client,
query MyInput,
queries []*UserQueryInput,
) (*MyMultipleDirectivesResponse, error) {
req := &graphql.Request{
OpName: "MultipleDirectives",
Query: `
// The query or mutation executed by MultipleDirectives.
const MultipleDirectivesOperation = `
query MultipleDirectives ($query: UserQueryInput, $queries: [UserQueryInput]) {
user(query: $query) {
id
@@ -341,7 +335,16 @@ query MultipleDirectives ($query: UserQueryInput, $queries: [UserQueryInput]) {
id
}
}
`,
`
func MultipleDirectives(
client graphql.Client,
query MyInput,
queries []*UserQueryInput,
) (*MyMultipleDirectivesResponse, error) {
req := &graphql.Request{
OpName: "MultipleDirectives",
Query: MultipleDirectivesOperation,
Variables: &__MultipleDirectivesInput{
Query: query,
Queries: queries,
@@ -219,17 +219,8 @@ func (v *__OmitEmptyQueryInput) GetTz() string { return v.Tz }
// GetTzNoOmitEmpty returns __OmitEmptyQueryInput.TzNoOmitEmpty, and is useful for accessing the field via an interface.
func (v *__OmitEmptyQueryInput) GetTzNoOmitEmpty() string { return v.TzNoOmitEmpty }
func OmitEmptyQuery(
client graphql.Client,
query UserQueryInput,
queries []UserQueryInput,
dt time.Time,
tz string,
tzNoOmitEmpty string,
) (*OmitEmptyQueryResponse, error) {
req := &graphql.Request{
OpName: "OmitEmptyQuery",
Query: `
// The query or mutation executed by OmitEmptyQuery.
const OmitEmptyQueryOperation = `
query OmitEmptyQuery ($query: UserQueryInput, $queries: [UserQueryInput], $dt: DateTime, $tz: String, $tzNoOmitEmpty: String) {
user(query: $query) {
id
@@ -240,7 +231,19 @@ query OmitEmptyQuery ($query: UserQueryInput, $queries: [UserQueryInput], $dt: D
maybeConvert(dt: $dt, tz: $tz)
convert2: maybeConvert(dt: $dt, tz: $tzNoOmitEmpty)
}
`,
`
func OmitEmptyQuery(
client graphql.Client,
query UserQueryInput,
queries []UserQueryInput,
dt time.Time,
tz string,
tzNoOmitEmpty string,
) (*OmitEmptyQueryResponse, error) {
req := &graphql.Request{
OpName: "OmitEmptyQuery",
Query: OmitEmptyQueryOperation,
Variables: &__OmitEmptyQueryInput{
Query: query,
Queries: queries,
@@ -230,15 +230,8 @@ func (v *__PointersQueryInput) GetDt() time.Time { return v.Dt }
// GetTz returns __PointersQueryInput.Tz, and is useful for accessing the field via an interface.
func (v *__PointersQueryInput) GetTz() *string { return v.Tz }
func PointersQuery(
client graphql.Client,
query *UserQueryInput,
dt time.Time,
tz *string,
) (*PointersQueryResponse, error) {
req := &graphql.Request{
OpName: "PointersQuery",
Query: `
// The query or mutation executed by PointersQuery.
const PointersQueryOperation = `
query PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) {
user(query: $query) {
id
@@ -252,7 +245,17 @@ query PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) {
}
maybeConvert(dt: $dt, tz: $tz)
}
`,
`
func PointersQuery(
client graphql.Client,
query *UserQueryInput,
dt time.Time,
tz *string,
) (*PointersQueryResponse, error) {
req := &graphql.Request{
OpName: "PointersQuery",
Query: PointersQueryOperation,
Variables: &__PointersQueryInput{
Query: query,
Dt: dt,
@@ -227,15 +227,8 @@ func (v *__PointersQueryInput) GetDt() *time.Time { return v.Dt }
// GetTz returns __PointersQueryInput.Tz, and is useful for accessing the field via an interface.
func (v *__PointersQueryInput) GetTz() string { return v.Tz }
func PointersQuery(
client graphql.Client,
query *UserQueryInput,
dt *time.Time,
tz string,
) (*PointersQueryResponse, error) {
req := &graphql.Request{
OpName: "PointersQuery",
Query: `
// The query or mutation executed by PointersQuery.
const PointersQueryOperation = `
query PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) {
user(query: $query) {
id
@@ -249,7 +242,17 @@ query PointersQuery ($query: UserQueryInput, $dt: DateTime, $tz: String) {
}
maybeConvert(dt: $dt, tz: $tz)
}
`,
`
func PointersQuery(
client graphql.Client,
query *UserQueryInput,
dt *time.Time,
tz string,
) (*PointersQueryResponse, error) {
req := &graphql.Request{
OpName: "PointersQuery",
Query: PointersQueryOperation,
Variables: &__PointersQueryInput{
Query: query,
Dt: dt,
@@ -71,13 +71,8 @@ type __GetPokemonSiblingsInput struct {
// GetInput returns __GetPokemonSiblingsInput.Input, and is useful for accessing the field via an interface.
func (v *__GetPokemonSiblingsInput) GetInput() testutil.Pokemon { return v.Input }
func GetPokemonSiblings(
client graphql.Client,
input testutil.Pokemon,
) (*GetPokemonSiblingsResponse, error) {
req := &graphql.Request{
OpName: "GetPokemonSiblings",
Query: `
// The query or mutation executed by GetPokemonSiblings.
const GetPokemonSiblingsOperation = `
query GetPokemonSiblings ($input: PokemonInput!) {
user(query: {hasPokemon:$input}) {
id
@@ -93,7 +88,15 @@ query GetPokemonSiblings ($input: PokemonInput!) {
}
}
}
`,
`
func GetPokemonSiblings(
client graphql.Client,
input testutil.Pokemon,
) (*GetPokemonSiblingsResponse, error) {
req := &graphql.Request{
OpName: "GetPokemonSiblings",
Query: GetPokemonSiblingsOperation,
Variables: &__GetPokemonSiblingsInput{
Input: input,
},
@@ -40,19 +40,22 @@ func (v *QueryWithAliasUser) GetID() testutil.ID { return v.ID }
// GetOtherID returns QueryWithAliasUser.OtherID, and is useful for accessing the field via an interface.
func (v *QueryWithAliasUser) GetOtherID() testutil.ID { return v.OtherID }
func QueryWithAlias(
client graphql.Client,
) (*QueryWithAliasResponse, error) {
req := &graphql.Request{
OpName: "QueryWithAlias",
Query: `
// The query or mutation executed by QueryWithAlias.
const QueryWithAliasOperation = `
query QueryWithAlias {
User: user {
ID: id
otherID: id
}
}
`,
`
func QueryWithAlias(
client graphql.Client,
) (*QueryWithAliasResponse, error) {
req := &graphql.Request{
OpName: "QueryWithAlias",
Query: QueryWithAliasOperation,
}
var err error
@@ -40,19 +40,22 @@ func (v *QueryWithDoubleAliasUser) GetID() testutil.ID { return v.ID }
// GetAlsoID returns QueryWithDoubleAliasUser.AlsoID, and is useful for accessing the field via an interface.
func (v *QueryWithDoubleAliasUser) GetAlsoID() testutil.ID { return v.AlsoID }
func QueryWithDoubleAlias(
client graphql.Client,
) (*QueryWithDoubleAliasResponse, error) {
req := &graphql.Request{
OpName: "QueryWithDoubleAlias",
Query: `
// The query or mutation executed by QueryWithDoubleAlias.
const QueryWithDoubleAliasOperation = `
query QueryWithDoubleAlias {
user {
ID: id
AlsoID: id
}
}
`,
`
func QueryWithDoubleAlias(
client graphql.Client,
) (*QueryWithDoubleAliasResponse, error) {
req := &graphql.Request{
OpName: "QueryWithDoubleAlias",
Query: QueryWithDoubleAliasOperation,
}
var err error
@@ -62,12 +62,8 @@ const (
RoleTeacher Role = "TEACHER"
)
func QueryWithEnums(
client graphql.Client,
) (*QueryWithEnumsResponse, error) {
req := &graphql.Request{
OpName: "QueryWithEnums",
Query: `
// The query or mutation executed by QueryWithEnums.
const QueryWithEnumsOperation = `
query QueryWithEnums {
user {
roles
@@ -76,7 +72,14 @@ query QueryWithEnums {
roles
}
}
`,
`
func QueryWithEnums(
client graphql.Client,
) (*QueryWithEnumsResponse, error) {
req := &graphql.Request{
OpName: "QueryWithEnums",
Query: QueryWithEnumsOperation,
}
var err error
@@ -41,12 +41,8 @@ func (v *QueryWithSlicesUser) GetEmailsWithNulls() []string { return v.EmailsWit
// GetEmailsWithNullsOrNull returns QueryWithSlicesUser.EmailsWithNullsOrNull, and is useful for accessing the field via an interface.
func (v *QueryWithSlicesUser) GetEmailsWithNullsOrNull() []string { return v.EmailsWithNullsOrNull }
func QueryWithSlices(
client graphql.Client,
) (*QueryWithSlicesResponse, error) {
req := &graphql.Request{
OpName: "QueryWithSlices",
Query: `
// The query or mutation executed by QueryWithSlices.
const QueryWithSlicesOperation = `
query QueryWithSlices {
user {
emails
@@ -55,7 +51,14 @@ query QueryWithSlices {
emailsWithNullsOrNull
}
}
`,
`
func QueryWithSlices(
client graphql.Client,
) (*QueryWithSlicesResponse, error) {
req := &graphql.Request{
OpName: "QueryWithSlices",
Query: QueryWithSlicesOperation,
}
var err error
@@ -43,12 +43,8 @@ func (v *QueryWithStructsUserAuthMethodsAuthMethod) GetProvider() string { retur
// GetEmail returns QueryWithStructsUserAuthMethodsAuthMethod.Email, and is useful for accessing the field via an interface.
func (v *QueryWithStructsUserAuthMethodsAuthMethod) GetEmail() string { return v.Email }
func QueryWithStructs(
client graphql.Client,
) (*QueryWithStructsResponse, error) {
req := &graphql.Request{
OpName: "QueryWithStructs",
Query: `
// The query or mutation executed by QueryWithStructs.
const QueryWithStructsOperation = `
query QueryWithStructs {
user {
authMethods {
@@ -57,7 +53,14 @@ query QueryWithStructs {
}
}
}
`,
`
func QueryWithStructs(
client graphql.Client,
) (*QueryWithStructsResponse, error) {
req := &graphql.Request{
OpName: "QueryWithStructs",
Query: QueryWithStructsOperation,
}
var err error
@@ -68,13 +68,8 @@ type __RecursionInput struct {
// GetInput returns __RecursionInput.Input, and is useful for accessing the field via an interface.
func (v *__RecursionInput) GetInput() RecursiveInput { return v.Input }
func Recursion(
client graphql.Client,
input RecursiveInput,
) (*RecursionResponse, error) {
req := &graphql.Request{
OpName: "Recursion",
Query: `
// The query or mutation executed by Recursion.
const RecursionOperation = `
query Recursion ($input: RecursiveInput!) {
recur(input: $input) {
rec {
@@ -86,7 +81,15 @@ query Recursion ($input: RecursiveInput!) {
}
}
}
`,
`
func Recursion(
client graphql.Client,
input RecursiveInput,
) (*RecursionResponse, error) {
req := &graphql.Request{
OpName: "Recursion",
Query: RecursionOperation,
Variables: &__RecursionInput{
Input: input,
},
@@ -239,12 +239,8 @@ func (v *SimpleInlineFragmentResponse) __premarshalJSON() (*__premarshalSimpleIn
return &retval, nil
}
func SimpleInlineFragment(
client graphql.Client,
) (*SimpleInlineFragmentResponse, error) {
req := &graphql.Request{
OpName: "SimpleInlineFragment",
Query: `
// The query or mutation executed by SimpleInlineFragment.
const SimpleInlineFragmentOperation = `
query SimpleInlineFragment {
randomItem {
__typename
@@ -258,7 +254,14 @@ query SimpleInlineFragment {
}
}
}
`,
`
func SimpleInlineFragment(
client graphql.Client,
) (*SimpleInlineFragmentResponse, error) {
req := &graphql.Request{
OpName: "SimpleInlineFragment",
Query: SimpleInlineFragmentOperation,
}
var err error
@@ -41,19 +41,22 @@ type __SimpleInputQueryInput struct {
// GetName returns __SimpleInputQueryInput.Name, and is useful for accessing the field via an interface.
func (v *__SimpleInputQueryInput) GetName() string { return v.Name }
// The query or mutation executed by SimpleInputQuery.
const SimpleInputQueryOperation = `
query SimpleInputQuery ($name: String!) {
user(query: {name:$name}) {
id
}
}
`
func SimpleInputQuery(
client graphql.Client,
name string,
) (*SimpleInputQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleInputQuery",
Query: `
query SimpleInputQuery ($name: String!) {
user(query: {name:$name}) {
id
}
}
`,
Query: SimpleInputQueryOperation,
Variables: &__SimpleInputQueryInput{
Name: name,
},
@@ -41,6 +41,16 @@ type __SimpleMutationInput struct {
// GetName returns __SimpleMutationInput.Name, and is useful for accessing the field via an interface.
func (v *__SimpleMutationInput) GetName() string { return v.Name }
// The query or mutation executed by SimpleMutation.
const SimpleMutationOperation = `
mutation SimpleMutation ($name: String!) {
createUser(name: $name) {
id
name
}
}
`
// SimpleMutation creates a user.
//
// It has a long doc-comment, to test that we handle that correctly.
@@ -51,14 +61,7 @@ func SimpleMutation(
) (*SimpleMutationResponse, error) {
req := &graphql.Request{
OpName: "SimpleMutation",
Query: `
mutation SimpleMutation ($name: String!) {
createUser(name: $name) {
id
name
}
}
`,
Query: SimpleMutationOperation,
Variables: &__SimpleMutationInput{
Name: name,
},
@@ -546,12 +546,8 @@ type VideoFieldsThumbnail struct {
// GetId returns VideoFieldsThumbnail.Id, and is useful for accessing the field via an interface.
func (v *VideoFieldsThumbnail) GetId() testutil.ID { return v.Id }
func SimpleNamedFragment(
client graphql.Client,
) (*SimpleNamedFragmentResponse, error) {
req := &graphql.Request{
OpName: "SimpleNamedFragment",
Query: `
// The query or mutation executed by SimpleNamedFragment.
const SimpleNamedFragmentOperation = `
query SimpleNamedFragment {
randomItem {
__typename
@@ -573,7 +569,14 @@ fragment VideoFields on Video {
id
}
}
`,
`
func SimpleNamedFragment(
client graphql.Client,
) (*SimpleNamedFragmentResponse, error) {
req := &graphql.Request{
OpName: "SimpleNamedFragment",
Query: SimpleNamedFragmentOperation,
}
var err error
@@ -33,18 +33,21 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() testutil.ID { return v.Id }
func SimpleQuery(
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`,
`
func SimpleQuery(
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: SimpleQueryOperation,
}
var err error
@@ -424,12 +424,8 @@ type VideoFields struct {
// GetDuration returns VideoFields.Duration, and is useful for accessing the field via an interface.
func (v *VideoFields) GetDuration() int { return v.Duration }
func StructOption(
client graphql.Client,
) (*StructOptionResponse, error) {
req := &graphql.Request{
OpName: "StructOption",
Query: `
// The query or mutation executed by StructOption.
const StructOptionOperation = `
query StructOption {
root {
id
@@ -457,7 +453,14 @@ query StructOption {
fragment VideoFields on Video {
duration
}
`,
`
func StructOption(
client graphql.Client,
) (*StructOptionResponse, error) {
req := &graphql.Request{
OpName: "StructOption",
Query: StructOptionOperation,
}
var err error
@@ -37,19 +37,22 @@ func (v *TypeNameQueryUser) GetTypename() string { return v.Typename }
// GetId returns TypeNameQueryUser.Id, and is useful for accessing the field via an interface.
func (v *TypeNameQueryUser) GetId() testutil.ID { return v.Id }
func TypeNameQuery(
client graphql.Client,
) (*TypeNameQueryResponse, error) {
req := &graphql.Request{
OpName: "TypeNameQuery",
Query: `
// The query or mutation executed by TypeNameQuery.
const TypeNameQueryOperation = `
query TypeNameQuery {
user {
__typename
id
}
}
`,
`
func TypeNameQuery(
client graphql.Client,
) (*TypeNameQueryResponse, error) {
req := &graphql.Request{
OpName: "TypeNameQuery",
Query: TypeNameQueryOperation,
}
var err error
@@ -264,12 +264,8 @@ func (v *User) GetId() testutil.ID { return v.Id }
// GetName returns User.Name, and is useful for accessing the field via an interface.
func (v *User) GetName() string { return v.Name }
func TypeNames(
client graphql.Client,
) (*Resp, error) {
req := &graphql.Request{
OpName: "TypeNames",
Query: `
// The query or mutation executed by TypeNames.
const TypeNamesOperation = `
query TypeNames {
user {
id
@@ -285,7 +281,14 @@ query TypeNames {
name
}
}
`,
`
func TypeNames(
client graphql.Client,
) (*Resp, error) {
req := &graphql.Request{
OpName: "TypeNames",
Query: TypeNamesOperation,
}
var err error
@@ -174,18 +174,21 @@ func (v *UnionNoFragmentsQueryResponse) __premarshalJSON() (*__premarshalUnionNo
return &retval, nil
}
func UnionNoFragmentsQuery(
client graphql.Client,
) (*UnionNoFragmentsQueryResponse, error) {
req := &graphql.Request{
OpName: "UnionNoFragmentsQuery",
Query: `
// The query or mutation executed by UnionNoFragmentsQuery.
const UnionNoFragmentsQueryOperation = `
query UnionNoFragmentsQuery {
randomLeaf {
__typename
}
}
`,
`
func UnionNoFragmentsQuery(
client graphql.Client,
) (*UnionNoFragmentsQueryResponse, error) {
req := &graphql.Request{
OpName: "UnionNoFragmentsQuery",
Query: UnionNoFragmentsQueryOperation,
}
var err error
@@ -62,12 +62,8 @@ func (v *UsesEnumTwiceQueryResponse) GetMe() UsesEnumTwiceQueryMeUser { return v
// GetOtherUser returns UsesEnumTwiceQueryResponse.OtherUser, and is useful for accessing the field via an interface.
func (v *UsesEnumTwiceQueryResponse) GetOtherUser() UsesEnumTwiceQueryOtherUser { return v.OtherUser }
func UsesEnumTwiceQuery(
client graphql.Client,
) (*UsesEnumTwiceQueryResponse, error) {
req := &graphql.Request{
OpName: "UsesEnumTwiceQuery",
Query: `
// The query or mutation executed by UsesEnumTwiceQuery.
const UsesEnumTwiceQueryOperation = `
query UsesEnumTwiceQuery {
Me: user {
roles
@@ -76,7 +72,14 @@ query UsesEnumTwiceQuery {
roles
}
}
`,
`
func UsesEnumTwiceQuery(
client graphql.Client,
) (*UsesEnumTwiceQueryResponse, error) {
req := &graphql.Request{
OpName: "UsesEnumTwiceQuery",
Query: UsesEnumTwiceQueryOperation,
}
var err error
@@ -177,19 +177,22 @@ type unexportedUser struct {
// GetId returns unexportedUser.Id, and is useful for accessing the field via an interface.
func (v *unexportedUser) GetId() testutil.ID { return v.Id }
// The query or mutation executed by unexported.
const unexportedOperation = `
query unexported ($query: UserQueryInput) {
user(query: $query) {
id
}
}
`
func unexported(
client graphql.Client,
query UserQueryInput,
) (*unexportedResponse, error) {
req := &graphql.Request{
OpName: "unexported",
Query: `
query unexported ($query: UserQueryInput) {
user(query: $query) {
id
}
}
`,
Query: unexportedOperation,
Variables: &__unexportedInput{
Query: query,
},
@@ -35,18 +35,21 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
func SimpleQuery(
ctx context.Context,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`,
`
func SimpleQuery(
ctx context.Context,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: SimpleQueryOperation,
}
var err error
var client graphql.Client
@@ -38,18 +38,21 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
func SimpleQuery(
ctx testutil.MyContext,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`,
`
func SimpleQuery(
ctx testutil.MyContext,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: SimpleQueryOperation,
}
var err error
var client graphql.Client
@@ -33,16 +33,19 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
func SimpleQuery() (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`,
`
func SimpleQuery() (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: SimpleQueryOperation,
}
var err error
var client graphql.Client
@@ -38,19 +38,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx testutil.MyContext,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -38,19 +38,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx junkfunname.MyContext,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -34,19 +34,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx context.Context,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -34,19 +34,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx context.Context,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -34,19 +34,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx context.Context,
client graphql.Client,
) (*SimpleQueryResponse, map[string]interface{}, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -32,18 +32,21 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
func SimpleQuery(
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`,
`
func SimpleQuery(
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: SimpleQueryOperation,
}
var err error
@@ -77,6 +77,15 @@ type __ListInputQueryInput struct {
// GetNames returns __ListInputQueryInput.Names, and is useful for accessing the field via an interface.
func (v *__ListInputQueryInput) GetNames() []*string { return v.Names }
// The query or mutation executed by ListInputQuery.
const ListInputQueryOperation = `
query ListInputQuery ($names: [String]) {
user(query: {names:$names}) {
id
}
}
`
func ListInputQuery(
ctx context.Context,
client graphql.Client,
@@ -84,13 +93,7 @@ func ListInputQuery(
) (*ListInputQueryResponse, error) {
req := &graphql.Request{
OpName: "ListInputQuery",
Query: `
query ListInputQuery ($names: [String]) {
user(query: {names:$names}) {
id
}
}
`,
Query: ListInputQueryOperation,
Variables: &__ListInputQueryInput{
Names: names,
},
@@ -109,13 +112,8 @@ query ListInputQuery ($names: [String]) {
return &data, err
}
func QueryWithSlices(
ctx context.Context,
client graphql.Client,
) (*QueryWithSlicesResponse, error) {
req := &graphql.Request{
OpName: "QueryWithSlices",
Query: `
// The query or mutation executed by QueryWithSlices.
const QueryWithSlicesOperation = `
query QueryWithSlices {
user {
emails
@@ -124,7 +122,15 @@ query QueryWithSlices {
emailsWithNullsOrNull
}
}
`,
`
func QueryWithSlices(
ctx context.Context,
client graphql.Client,
) (*QueryWithSlicesResponse, error) {
req := &graphql.Request{
OpName: "QueryWithSlices",
Query: QueryWithSlicesOperation,
}
var err error
@@ -77,6 +77,15 @@ type __ListInputQueryInput struct {
// GetNames returns __ListInputQueryInput.Names, and is useful for accessing the field via an interface.
func (v *__ListInputQueryInput) GetNames() []string { return v.Names }
// The query or mutation executed by ListInputQuery.
const ListInputQueryOperation = `
query ListInputQuery ($names: [String]) {
user(query: {names:$names}) {
id
}
}
`
func ListInputQuery(
ctx context.Context,
client graphql.Client,
@@ -84,13 +93,7 @@ func ListInputQuery(
) (*ListInputQueryResponse, error) {
req := &graphql.Request{
OpName: "ListInputQuery",
Query: `
query ListInputQuery ($names: [String]) {
user(query: {names:$names}) {
id
}
}
`,
Query: ListInputQueryOperation,
Variables: &__ListInputQueryInput{
Names: names,
},
@@ -109,13 +112,8 @@ query ListInputQuery ($names: [String]) {
return &data, err
}
func QueryWithSlices(
ctx context.Context,
client graphql.Client,
) (*QueryWithSlicesResponse, error) {
req := &graphql.Request{
OpName: "QueryWithSlices",
Query: `
// The query or mutation executed by QueryWithSlices.
const QueryWithSlicesOperation = `
query QueryWithSlices {
user {
emails
@@ -124,7 +122,15 @@ query QueryWithSlices {
emailsWithNullsOrNull
}
}
`,
`
func QueryWithSlices(
ctx context.Context,
client graphql.Client,
) (*QueryWithSlicesResponse, error) {
req := &graphql.Request{
OpName: "QueryWithSlices",
Query: QueryWithSlicesOperation,
}
var err error
@@ -35,19 +35,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() testutil.ID { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx context.Context,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -34,19 +34,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx context.Context,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -34,19 +34,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx context.Context,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -34,19 +34,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx context.Context,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error
@@ -34,19 +34,22 @@ type SimpleQueryUser struct {
// GetId returns SimpleQueryUser.Id, and is useful for accessing the field via an interface.
func (v *SimpleQueryUser) GetId() string { return v.Id }
// The query or mutation executed by SimpleQuery.
const SimpleQueryOperation = `
query SimpleQuery {
user {
id
}
}
`
func SimpleQuery(
ctx context.Context,
client graphql.Client,
) (*SimpleQueryResponse, error) {
req := &graphql.Request{
OpName: "SimpleQuery",
Query: `
query SimpleQuery {
user {
id
}
}
`,
Query: SimpleQueryOperation,
}
var err error