graphql

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GraphiQLPage = []byte(`
<!DOCTYPE html>
<html>
	<head>
		<link href="https://cdnjs.cloudflare.com/ajax/libs/graphiql/0.11.11/graphiql.min.css" rel="stylesheet" />
		<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.2.0/umd/react.production.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.2.0/umd/react-dom.production.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/graphiql/0.11.11/graphiql.min.js"></script>
	</head>
	<body style="width: 100%; height: 100%; margin: 0; overflow: hidden;">
		<div id="graphiql" style="height: 100vh;">Loading...</div>
		<script>
			function graphQLFetcher(graphQLParams) {
				return fetch("/graphql", {
					method: "post",
					body: JSON.stringify(graphQLParams),
					credentials: "include",
				}).then(function (response) {
					return response.text();
				}).then(function (responseBody) {
					try {
						return JSON.parse(responseBody);
					} catch (error) {
						return responseBody;
					}
				});
			}
			ReactDOM.render(
				React.createElement(GraphiQL, {fetcher: graphQLFetcher}),
				document.getElementById("graphiql")
			);
		</script>
	</body>
</html>
`)

Functions

func DecodeCursor

func DecodeCursor(after *string) (*string, error)

func EncodeCursor

func EncodeCursor(i *string) graphql.ID

func WrapContext

func WrapContext(ctx context.Context, h http.Handler) http.Handler

Types

type GraphiQLHandler

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

func NewGraphiQLHandler

func NewGraphiQLHandler(schema string) *GraphiQLHandler

func (*GraphiQLHandler) ServeHTTP

func (t *GraphiQLHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Handler

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

func NewHandler

func NewHandler(schema string, resolver interface{}) *Handler

func (*Handler) ServeHTTP

func (t *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LoggerHandler

type LoggerHandler struct {
	DebugMode bool
}

func (*LoggerHandler) Logging

func (l *LoggerHandler) Logging(h http.Handler) http.Handler

type PageInfoResolver

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

func NewPageInfoResolver

func NewPageInfoResolver(start, end *string, hasNext bool) *PageInfoResolver

func (*PageInfoResolver) EndCursor

func (t *PageInfoResolver) EndCursor() *graphql.ID

func (*PageInfoResolver) HasNextPage

func (t *PageInfoResolver) HasNextPage() bool

func (*PageInfoResolver) StartCursor

func (t *PageInfoResolver) StartCursor() *graphql.ID

Jump to

Keyboard shortcuts

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