graphql-0.7.0.0: Haskell GraphQL implementation

Safe HaskellNone
LanguageHaskell2010

Language.GraphQL.Schema

Contents

Description

This module provides a representation of a GraphQL Schema in addition to functions for defining and manipulating schemas.

Synopsis

Documentation

data Resolver m Source #

Resolves a Field into an Aeson.Object with error information (if an error has occurred). m is an arbitrary monad, usually IO.

Constructors

Resolver 

Fields

type Subs = HashMap Name Value Source #

Contains variables for the query. The key of the map is a variable name, and the value is the variable value.

object :: Monad m => Name -> ActionT m [Resolver m] -> Resolver m Source #

Create a new Resolver with the given Name from the given Resolvers.

resolve :: Monad m => HashMap Text (Field -> CollectErrsT m Object) -> Seq Selection -> CollectErrsT m Value Source #

Takes a list of Resolvers and a list of Fields and applies each Resolver to each Field. Resolves into a value containing the resolved Field, or a null value and error information.

resolversToMap :: (Foldable f, Functor f) => f (Resolver m) -> HashMap Text (Field -> CollectErrsT m Object) Source #

Converts resolvers to a map.

scalar :: (Monad m, ToJSON a) => Name -> ActionT m a -> Resolver m Source #

A scalar represents a primitive value, like a string or an integer.

wrappedObject :: Monad m => Name -> ActionT m (Wrapping [Resolver m]) -> Resolver m Source #

Like object but can be null or a list of objects.

wrappedScalar :: (Monad m, ToJSON a) => Name -> ActionT m (Wrapping a) -> Resolver m Source #

Like scalar but can be null or a list of scalars.

AST Reexports

data Field Source #

Single GraphQL field.

Instances
Eq Field Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

(==) :: Field -> Field -> Bool #

(/=) :: Field -> Field -> Bool #

Show Field Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

showsPrec :: Int -> Field -> ShowS #

show :: Field -> String #

showList :: [Field] -> ShowS #

data Value Source #

Represents accordingly typed GraphQL values.

Constructors

Int Int32 
Float Double

GraphQL Float is double precision

String Text 
Boolean Bool 
Null 
Enum Name 
List [Value] 
Object (HashMap Name Value) 
Instances
Eq Value Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

Show Value Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

IsString Value Source # 
Instance details

Defined in Language.GraphQL.AST.Core

Methods

fromString :: String -> Value #