Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
Generate generates a graphql body from a struct. Returns the graphql body and error.
Example ¶
type Data struct { ID string Name string `json:"name"` CreationTime string `graphql:"createdOn"` ActiveProjects struct { ID string `json:"id"` } `json:"projects" graphql:"projects(filter: \"active\")"` } s, err := Generate(Data{}, nil) if err != nil { panic(err) } fmt.Println(s)
Output: ID name createdOn projects(filter: "active"){ id }
func GenerateFromReflectValue ¶
GenerateFromReflectValue generates a graphql body from reflect Type. Returns the graphql body and error.
func Generatef ¶
Generatef generates a graphql body from a struct. Returns the graphql body and error.
Example ¶
type Data struct { ID string Name string `json:"name"` CreationTime string `graphql:"createdOn"` ActiveProjects struct { ID string `json:"id"` } `json:"projects" graphql:"projects(filter: %q)"` } s, err := Generatef(Data{}, nil, "active") if err != nil { panic(err) } fmt.Println(s)
Output: ID name createdOn projects(filter: "active"){ id }
Types ¶
type InvalidTypeError ¶
type InvalidTypeError struct{}
InvalidTypeError indicates that the type is invalid or not supported.
func (InvalidTypeError) Error ¶
func (InvalidTypeError) Error() string
Click to show internal directories.
Click to hide internal directories.