graphql: github.com/nautilus/graphql Index | Files

package graphql

import "github.com/nautilus/graphql"

Index

Package Files

error.go file.go format.go graphql.go introspection.go language.go printer.go queryer.go queryerMultiOp.go queryerNetwork.go

Variables

var IntrospectionQuery = "" /* 1143 byte string literal not displayed */

IntrospectionQuery is the query that is fired at an API to reconstruct its schema

func ApplyFragments Uses

func ApplyFragments(selectionSet ast.SelectionSet, fragmentDefs ast.FragmentDefinitionList) (ast.SelectionSet, error)

ApplyFragments takes a list of selections and merges them into one, embedding any fragments it runs into along the way

func ExtractVariables Uses

func ExtractVariables(args ast.ArgumentList) []string

ExtractVariables takes a list of arguments and returns a list of every variable used

func FormatSelectionSet Uses

func FormatSelectionSet(selection ast.SelectionSet) string

FormatSelectionSet returns a pretty printed version of a selection set

func IntrospectAPI Uses

func IntrospectAPI(queryer Queryer) (*ast.Schema, error)

IntrospectAPI send the introspection query to a Queryer and builds up the schema object described by the result

func LoadSchema Uses

func LoadSchema(typedef string) (*ast.Schema, error)

LoadSchema takes an SDL string and returns the parsed version

func PrintQuery Uses

func PrintQuery(document *ast.QueryDocument) (string, error)

PrintQuery creates a string representation of an operation

func SelectedFields Uses

func SelectedFields(source ast.SelectionSet) []*ast.Field

type CollectedField Uses

type CollectedField struct {
    *ast.Field
    NestedSelections []ast.SelectionSet
}

CollectedField is a representations of a field with the list of selection sets that must be merged under that field.

type CollectedFieldList Uses

type CollectedFieldList []*CollectedField

CollectedFieldList is a list of CollectedField with utilities for retrieving them

func (*CollectedFieldList) GetOrCreateForAlias Uses

func (c *CollectedFieldList) GetOrCreateForAlias(alias string, creator func() *CollectedField) *CollectedField

type Error Uses

type Error struct {
    Extensions map[string]interface{} `json:"extensions"`
    Message    string                 `json:"message"`
    Path       []interface{}          `json:"path,omitempty"`
}

Error represents a graphql error

func NewError Uses

func NewError(code string, message string) *Error

NewError returns a graphql error with the given code and message

func (*Error) Error Uses

func (e *Error) Error() string

type ErrorList Uses

type ErrorList []error

ErrorList represents a list of errors

func (ErrorList) Error Uses

func (list ErrorList) Error() string

Error returns a string representation of each error

type File Uses

type File interface {
    io.Reader
    io.Closer
}

type HTTPQueryer Uses

type HTTPQueryer interface {
    WithHTTPClient(client *http.Client) Queryer
}

HTTPQueryer is an interface for queryers that let you configure an underlying http.Client

type HTTPQueryerWithMiddlewares Uses

type HTTPQueryerWithMiddlewares interface {
    WithHTTPClient(client *http.Client) Queryer
    WithMiddlewares(wares []NetworkMiddleware) Queryer
}

HTTPQueryerWithMiddlewares is an interface for queryers that let you configure an underlying http.Client and accept middlewares

type IntrospectionInputValue Uses

type IntrospectionInputValue struct {
    Name         string               `json:"name"`
    Description  string               `json:"description"`
    DefaultValue string               `json:"defaultValue"`
    Type         IntrospectionTypeRef `json:"type"`
}

type IntrospectionQueryDirective Uses

type IntrospectionQueryDirective struct {
    Name        string                    `json:"name"`
    Description string                    `json:"description"`
    Locations   []string                  `json:"locations"`
    Args        []IntrospectionInputValue `json:"arg"`
}

type IntrospectionQueryEnumDefinition Uses

type IntrospectionQueryEnumDefinition struct {
    Name              string `json:"name"`
    Description       string `json:"description"`
    IsDeprecated      bool   `json:"isDeprecated"`
    DeprecationReason string `json:"deprecationReason"`
}

type IntrospectionQueryFullType Uses

type IntrospectionQueryFullType struct {
    Kind          string                             `json:"kind"`
    Name          string                             `json:"name"`
    Description   string                             `json:"description"`
    InputFields   []IntrospectionInputValue          `json:"inputFields"`
    Interfaces    []IntrospectionTypeRef             `json:"interfaces"`
    PossibleTypes []IntrospectionTypeRef             `json:"possibleTypes"`
    Fields        []IntrospectionQueryFullTypeField  `json:"fields"`
    EnumValues    []IntrospectionQueryEnumDefinition `json:"enumValues"`
}

type IntrospectionQueryFullTypeField Uses

type IntrospectionQueryFullTypeField struct {
    Name              string                    `json:"name"`
    Description       string                    `json:"description"`
    Args              []IntrospectionInputValue `json:"args"`
    Type              IntrospectionTypeRef      `json:"type"`
    IsDeprecated      bool                      `json:"isDeprecated"`
    DeprecationReason string                    `json:"deprecationReason"`
}

type IntrospectionQueryResult Uses

type IntrospectionQueryResult struct {
    Schema *IntrospectionQuerySchema `json:"__schema"`
}

type IntrospectionQueryRootType Uses

type IntrospectionQueryRootType struct {
    Name string `json:"name"`
}

type IntrospectionQuerySchema Uses

type IntrospectionQuerySchema struct {
    QueryType        IntrospectionQueryRootType    `json:"queryType"`
    MutationType     *IntrospectionQueryRootType   `json:"mutationType"`
    SubscriptionType *IntrospectionQueryRootType   `json:"subscriptionType"`
    Types            []IntrospectionQueryFullType  `json:"types"`
    Directives       []IntrospectionQueryDirective `json:"directives"`
}

type IntrospectionTypeRef Uses

type IntrospectionTypeRef struct {
    Kind   string                `json:"kind"`
    Name   string                `json:"name"`
    OfType *IntrospectionTypeRef `json:"ofType"`
}

type MockSuccessQueryer Uses

type MockSuccessQueryer struct {
    Value interface{}
}

MockSuccessQueryer responds with pre-defined value when executing a query

func (*MockSuccessQueryer) Query Uses

func (q *MockSuccessQueryer) Query(ctx context.Context, input *QueryInput, receiver interface{}) error

Query looks up the name of the query in the map of responses and returns the value

type MultiOpQueryer Uses

type MultiOpQueryer struct {
    MaxBatchSize  int
    BatchInterval time.Duration
    // contains filtered or unexported fields
}

MultiOpQueryer is a queryer that will batch subsequent query on some interval into a single network request to a single target

func NewMultiOpQueryer Uses

func NewMultiOpQueryer(url string, interval time.Duration, maxBatchSize int) *MultiOpQueryer

NewMultiOpQueryer returns a MultiOpQueryer with the provided parameters

func (*MultiOpQueryer) Query Uses

func (q *MultiOpQueryer) Query(ctx context.Context, input *QueryInput, receiver interface{}) error

Query bundles queries that happen within the given interval into a single network request whose body is a list of the operation payload.

func (*MultiOpQueryer) WithHTTPClient Uses

func (q *MultiOpQueryer) WithHTTPClient(client *http.Client) Queryer

WithHTTPClient lets the user configure the client to use when making network requests

func (*MultiOpQueryer) WithMiddlewares Uses

func (q *MultiOpQueryer) WithMiddlewares(mwares []NetworkMiddleware) Queryer

WithMiddlewares lets the user assign middlewares to the queryer

type NetworkMiddleware Uses

type NetworkMiddleware func(*http.Request) error

NetworkMiddleware are functions can be passed to SingleRequestQueryer.WithMiddleware to affect its internal behavior

type NetworkQueryer Uses

type NetworkQueryer struct {
    URL         string
    Middlewares []NetworkMiddleware
    Client      *http.Client
}

func (*NetworkQueryer) ExtractErrors Uses

func (q *NetworkQueryer) ExtractErrors(result map[string]interface{}) error

ExtractErrors takes the result from a remote query and writes it to the provided pointer

func (*NetworkQueryer) SendMultipart Uses

func (q *NetworkQueryer) SendMultipart(ctx context.Context, payload []byte, contentType string) ([]byte, error)

SendMultipart is responsible for sending multipart request to the desingated URL

func (*NetworkQueryer) SendQuery Uses

func (q *NetworkQueryer) SendQuery(ctx context.Context, payload []byte) ([]byte, error)

SendQuery is responsible for sending the provided payload to the desingated URL

type QueryInput Uses

type QueryInput struct {
    Query         string                 `json:"query"`
    QueryDocument *ast.QueryDocument     `json:"-"`
    OperationName string                 `json:"operationName"`
    Variables     map[string]interface{} `json:"variables"`
}

QueryInput provides all of the information required to fire a query

func (*QueryInput) Raw Uses

func (i *QueryInput) Raw() interface{}

Raw returns the "raw underlying value of the key" when used by dataloader

func (*QueryInput) String Uses

func (i *QueryInput) String() string

String returns a guaranteed unique string that can be used to identify the input

type Queryer Uses

type Queryer interface {
    Query(context.Context, *QueryInput, interface{}) error
}

Queryer is a interface for objects that can perform

type QueryerFunc Uses

type QueryerFunc func(*QueryInput) (interface{}, error)

QueryerFunc responds to the query by calling the provided function

func (QueryerFunc) Query Uses

func (q QueryerFunc) Query(ctx context.Context, input *QueryInput, receiver interface{}) error

Query invokes the provided function and writes the response to the receiver

type QueryerWithMiddlewares Uses

type QueryerWithMiddlewares interface {
    WithMiddlewares(wares []NetworkMiddleware) Queryer
}

QueryerWithMiddlewares is an interface for queryers that support network middlewares

type RemoteSchema Uses

type RemoteSchema struct {
    Schema *ast.Schema
    URL    string
}

RemoteSchema encapsulates a particular schema that can be executed by sending network requests to the specified URL.

func IntrospectRemoteSchema Uses

func IntrospectRemoteSchema(url string) (*RemoteSchema, error)

IntrospectRemoteSchema is used to build a RemoteSchema by firing the introspection query at a remote service and reconstructing the schema object from the response

func IntrospectRemoteSchemas Uses

func IntrospectRemoteSchemas(urls ...string) ([]*RemoteSchema, error)

IntrospectRemoteSchemas takes a list of URLs and creates a RemoteSchema by invoking graphql.IntrospectRemoteSchema at that location.

type SingleRequestQueryer Uses

type SingleRequestQueryer struct {
    // contains filtered or unexported fields
}

SingleRequestQueryer sends the query to a url and returns the response

func NewSingleRequestQueryer Uses

func NewSingleRequestQueryer(url string) *SingleRequestQueryer

NewSingleRequestQueryer returns a SingleRequestQueryer pointed to the given url

func (*SingleRequestQueryer) Query Uses

func (q *SingleRequestQueryer) Query(ctx context.Context, input *QueryInput, receiver interface{}) error

Query sends the query to the designated url and returns the response.

func (*SingleRequestQueryer) URL Uses

func (q *SingleRequestQueryer) URL() string

func (*SingleRequestQueryer) WithHTTPClient Uses

func (q *SingleRequestQueryer) WithHTTPClient(client *http.Client) Queryer

WithHTTPClient lets the user configure the underlying http client being used

func (*SingleRequestQueryer) WithMiddlewares Uses

func (q *SingleRequestQueryer) WithMiddlewares(mwares []NetworkMiddleware) Queryer

WithMiddlewares returns a network queryer that will apply the provided middlewares

type Upload Uses

type Upload struct {
    File     File
    FileName string
}

type UploadMap Uses

type UploadMap []struct {
    // contains filtered or unexported fields
}

func (*UploadMap) Add Uses

func (u *UploadMap) Add(upload Upload, varName string)

func (*UploadMap) NotEmpty Uses

func (u *UploadMap) NotEmpty() bool

func (*UploadMap) UploadMap Uses

func (u *UploadMap) UploadMap() map[string][]string

Package graphql imports 19 packages (graph) and is imported by 4 packages. Updated 2020-10-20. Refresh now. Tools for package owners.