handlerx

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 20 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ErrDecodeJson   = 422
	ErrInvalidParam = 400
)

Variables

This section is empty.

Functions

func DbgPrint

func DbgPrint(r *http.Request, format string, v ...interface{})

func HTTPRequest2GraphQLQuery

func HTTPRequest2GraphQLQuery(r *http.Request, params *graphql.RawParams, body []byte) (string, error)

func NewDefaultServer

func NewDefaultServer(es graphql.ExecutableSchema) *handler.Server

func SetupHTTP2GraphQLMapping

func SetupHTTP2GraphQLMapping(operation RESTOperationType, selection RESTSelectionType, arguments RESTArgumentsType, inputs RESTArgumentsType)

Types

type ArgumentsType

type ArgumentsType map[string]string

GraphQL Operation => Operation Arguments Pair of <ArgName,ArgType>

type DELETE

type DELETE struct{}

DELETE implements the DELETE side of the default HTTP transport defined in https://github.com/APIs-guru/graphql-over-http#post

func (DELETE) Do

func (DELETE) Supports

func (h DELETE) Supports(r *http.Request) bool

type ErrorCode

type ErrorCode int

3. 全局错误码

type GET

type GET struct{}

GET implements the GET side of the default HTTP transport defined in https://github.com/APIs-guru/graphql-over-http#get

func (GET) Do

func (GET) Supports

func (h GET) Supports(r *http.Request) bool

type Options

type Options struct{}

Options responds to http OPTIONS and HEAD requests

func (Options) Do

func (Options) Supports

func (o Options) Supports(r *http.Request) bool

type POST

type POST struct{}

POST implements the POST side of the default HTTP transport defined in https://github.com/APIs-guru/graphql-over-http#post

func (POST) Do

func (POST) Supports

func (h POST) Supports(r *http.Request) bool

type ParamType

type ParamType map[string]interface{}

type RESTArgumentsType

type RESTArgumentsType map[string]ArgumentsType

type RESTOperationType

type RESTOperationType map[string]string

1. 类型声明 REST URL => GraphQL Operation

type RESTSelectionType

type RESTSelectionType map[string]string

GraphQL Operation => Fields Selection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL