Documentation ¶
Overview ¶
FieldInfo defines how fields of Go structs map to GraphQL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldInfo ¶
type FieldInfo struct {
// contains filtered or unexported fields
}
FieldInfo defines how a field of a Go struct maps to GraphQL, both when constructing operations (queries/mutations) and when unmarshalling the response.
func NewFieldInfo ¶
func NewFieldInfo(f reflect.StructField) FieldInfo
NewFieldInfo maps a field of a Go struct to GraphQL.
func (FieldInfo) GraphQL ¶
GraphQL returns a GraphQL snippet. Recall that Go structs correspond to selection sets in GraphQL and Go struct fields corresond to selections. See https://spec.graphql.org/October2021/#sec-Selection-Sets. In particular, the returned GraphQL snippet satisfies the InlineFragment or Field production in the language, except for the trailing SelectionSet. For example, this can return "... on User" or "name".
func (FieldInfo) Inline ¶
Inline returns true if the Go struct field has a struct type (i.e. a struct contained in a struct) and the "inner" struct fields should be "inlined" in the "outer" struct fields when constructing GraphQL selection sets.
func (FieldInfo) IsInlineFragment ¶
IsInlineFragment returns true if f.GraphQL() is an InlineFragment production (without the trailing selection set). I.e. the field of the Go struct defines an inline fragment. See https://spec.graphql.org/October2021/#sec-Selection-Sets.