Documentation ¶
Index ¶
- Variables
- func AddField(root *graphql.Object, field *graphql.Field)
- func Args(obj interface{}) graphql.FieldConfigArgument
- func ArgsOf(t reflect.Type) graphql.FieldConfigArgument
- func Field(t interface{}, options ...Option) graphql.Field
- func FieldOf(t reflect.Type, options ...Option) (graphql.Field, error)
- func InputObject(name string, obj interface{}) *graphql.InputObject
- func NewErrTypeNotRecognized(t reflect.Type) error
- func NewErrTypeNotRecognizedWithStruct(reason error, structType reflect.Type, structField reflect.StructField) error
- func Struct(obj interface{}) *graphql.Object
- type Encoder
- func (enc *Encoder) Args(obj interface{}) (graphql.FieldConfigArgument, error)
- func (enc *Encoder) ArgsOf(t reflect.Type) (graphql.FieldConfigArgument, error)
- func (enc *Encoder) ArrayOf(t reflect.Type, options ...Option) (graphql.Type, error)
- func (enc *Encoder) Field(t interface{}, options ...Option) (graphql.Field, error)
- func (enc *Encoder) FieldOf(t reflect.Type, options ...Option) (graphql.Field, error)
- func (enc *Encoder) InputObjectFieldMap(t reflect.Type) (graphql.InputObjectConfigFieldMap, error)
- func (enc *Encoder) Struct(obj interface{}, options ...Option) (*graphql.Object, error)
- func (enc *Encoder) StructOf(t reflect.Type, options ...Option) (*graphql.Object, error)
- type GraphqlResolver
- type GraphqlTyped
- type Option
- func WithArgs(args ...interface{}) Option
- func WithDefaultValue(defaultValue interface{}) Option
- func WithDeprecationReason(description string) Option
- func WithDescription(description string) Option
- func WithName(name string) Option
- func WithResolver(resolver graphql.FieldResolveFn) Option
- func WithType(t graphql.Type) Option
- type TypeNotRecognizedWithStructError
Constants ¶
This section is empty.
Variables ¶
var DefaultEncoder = NewEncoder()
Functions ¶
func Args ¶
func Args(obj interface{}) graphql.FieldConfigArgument
Args Obtain the arguments property of a mutation object
func InputObject ¶
func InputObject(name string, obj interface{}) *graphql.InputObject
func NewErrTypeNotRecognized ¶
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func NewEncoder() *Encoder
func (*Encoder) Args ¶
func (enc *Encoder) Args(obj interface{}) (graphql.FieldConfigArgument, error)
func (*Encoder) InputObjectFieldMap ¶
func (*Encoder) StructOf ¶
StructOf returns a `*graphql.Object` with the description extracted from the obj passed.
This method extracts the information needed from the fields of the obj informed. All fields tagged with "graphql" are added.
The "graphql" tag can be defined as:
```
type T struct { field string `graphql:"fieldname"` }
```
* fieldname: The name of the field.
type GraphqlResolver ¶
type GraphqlResolver interface { // GraphqlResolve is the method will be set to the `graphql.Field` as the // resolver method. GraphqlResolve(p graphql.ResolveParams) (interface{}, error) }
GraphqlResolver is the interface implemented by types that will provide a resolver.
type GraphqlTyped ¶
type GraphqlTyped interface { // GraphqlType returns the `graphql.Type` that represents the data type that // implements this interface. GraphqlType() graphql.Type }
GraphqlTyped is the interface implemented by types that will provide a special `graphql.Type`.
type Option ¶
type Option interface {
Apply(dst interface{}) error
}
Option describes how an option will behave when applied to a field.
func WithArgs ¶
func WithArgs(args ...interface{}) Option
WithArgs creates an `Option` that sets the arguments for a field.
It can be applied to: * Fields;
func WithDefaultValue ¶
func WithDefaultValue(defaultValue interface{}) Option
WithDefaultValue creates an `Option` that provides sets the description for arguments.
It can be applied to: * Arguments;
func WithDeprecationReason ¶
WithDeprecationReason creates an `Option` that sets the deprecation reason for fields.
It can be applied to: * Fields;
func WithDescription ¶
WithDescription creates an `Option` that provides sets the description for fields, objects and arguments.
It can be applied to: * Field; * Arguments; * Objects;
func WithName ¶
WithName creates an `Option` that provides sets the name for fields and objects
It can be applied to: * Field; * Objects;
func WithResolver ¶
func WithResolver(resolver graphql.FieldResolveFn) Option
WithResolver creates an `Option` that sets the resolver for fields.
It can be applied to: * Fields;
type TypeNotRecognizedWithStructError ¶
type TypeNotRecognizedWithStructError struct {
// contains filtered or unexported fields
}
func (*TypeNotRecognizedWithStructError) Error ¶
func (err *TypeNotRecognizedWithStructError) Error() string