Documentation ¶
Index ¶
- func ConvertSimpleType(objectType reflect.Type) (*graphql.Scalar, error)
- func ConvertStruct(objectType reflect.Type) graphql.Fields
- func ConvertStructToObject(objectType reflect.Type) *graphql.Object
- func GetArgs(object interface{}) graphql.FieldConfigArgument
- func GetFieldType(object reflect.StructField) graphql.Output
- func GetGraphQLObject(object interface{}) (*graphql.Object, error)
- func GetTagValue(objectType reflect.StructField, tagName string) string
- type SchemaBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertSimpleType ¶
ConvertSimpleType converts simple type to graphql field
func ConvertStruct ¶
ConvertStruct converts struct to graphql fields
func ConvertStructToObject ¶
ConvertStructToObject converts simple struct to graphql object
func GetArgs ¶
func GetArgs(object interface{}) graphql.FieldConfigArgument
func GetFieldType ¶
func GetFieldType(object reflect.StructField) graphql.Output
GetFieldType Converts object to a graphQL field type
func GetGraphQLObject ¶
GetGraphQLObject Converts struct into graphql object
func GetTagValue ¶
func GetTagValue(objectType reflect.StructField, tagName string) string
getTagValue returns tag value of a struct
Types ¶
type SchemaBuilder ¶
type SchemaBuilder struct { GraphQLType graphql.Output Object interface{} Schema graphql.Fields // contains filtered or unexported fields }
SchemaBuilder is used to build a schema based on a struct
func NewSchemaBuilder ¶
func NewSchemaBuilder( graphQLType graphql.Output, object interface{}, middlewareArg ...middlewareType) *SchemaBuilder
NewSchemaBuilder is used get a new schema builder
func (*SchemaBuilder) AddArgumentsFromStruct ¶
func (schemaBuilder *SchemaBuilder) AddArgumentsFromStruct(object interface{})
AddArgumentsFromStruct is used to add arguments from a struct
func (*SchemaBuilder) AddFunction ¶
func (schemaBuilder *SchemaBuilder) AddFunction( name, description string, function func(graphql.ResolveParams) (interface{}, error))
AddFunction adds a function
Click to show internal directories.
Click to hide internal directories.