Documentation
¶
Index ¶
- func DefaultNameFunc(nomsType *types.Type, isInputType bool) string
- func Error(err error, w io.Writer)
- func GetInputTypeName(nomsType *types.Type) string
- func GetTypeName(nomsType *types.Type) string
- func InputToNomsValue(vrw types.ValueReadWriter, arg interface{}, nomsType *types.Type) types.Value
- func MaybeGetScalar(v types.Value) interface{}
- func NewContext(vrw types.ValueReader) context.Context
- func NewRootQueryObject(rootValue types.Value, tm *TypeMap) *graphql.Object
- func NomsTypeToGraphQLInputType(nomsType *types.Type, tm *TypeMap) (graphql.Input, error)
- func NomsTypeToGraphQLType(nomsType *types.Type, boxedIfScalar bool, tm *TypeMap) graphql.Type
- func Query(rootValue types.Value, query string, vrw types.ValueReadWriter, w io.Writer)
- type NameFunc
- type TypeConverter
- type TypeMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultNameFunc ¶
DefaultNameFunc returns the GraphQL type name for a Noms type.
func GetInputTypeName ¶
GetInputTypeName returns a type name that is unique and useful for GraphQL input types.
func GetTypeName ¶
GetTypeName provides a unique type name that is used by GraphQL.
func InputToNomsValue ¶
InputToNomsValue converts a GraphQL input value (as used in arguments and variables) to a Noms value.
func MaybeGetScalar ¶
func NewContext ¶
func NewContext(vrw types.ValueReader) context.Context
NewContext creates a new context.Context with the extra data added to it that is required by ngql.
func NewRootQueryObject ¶
NewRootQueryObject creates a "root" query object that can be used to traverse the value tree of rootValue.
func NomsTypeToGraphQLInputType ¶
NomsTypeToGraphQLInputType creates a GraphQL input type from a Noms type. Input types may not be unions or cyclic structs. If we encounter those this returns an error.
func NomsTypeToGraphQLType ¶
NomsTypeToGraphQLType creates a GraphQL type from a Noms type that knows how to resolve the Noms values.
Types ¶
type TypeConverter ¶
type TypeConverter struct { NameFunc NameFunc // contains filtered or unexported fields }
TypeConverter provides functions to convert between Noms types and GraphQL types.
func NewTypeConverter ¶
func NewTypeConverter() *TypeConverter
NewTypeConverter creates a new TypeConverter.
func (*TypeConverter) NewRootQueryObject ¶
func (tc *TypeConverter) NewRootQueryObject(rootValue types.Value) *graphql.Object
NewRootQueryObject creates a "root" query object that can be used to traverse the value tree of rootValue.
func (*TypeConverter) NomsTypeToGraphQLInputType ¶
NomsTypeToGraphQLInputType creates a GraphQL input type from a Noms type. Input types may not be unions or cyclic structs. If we encounter those this returns an error.
func (*TypeConverter) NomsTypeToGraphQLType ¶
func (tc *TypeConverter) NomsTypeToGraphQLType(nomsType *types.Type) graphql.Type
NomsTypeToGraphQLType creates a GraphQL type from a Noms type that knows how to resolve the Noms values.