schema

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package schema can be used to generate a GraphQL schema (as a string) from Go structure(s) representing the GraphQL query (and mutation and subscription) entry points. This goes hand-in-hand with the "handler" which uses instantiations of those same structures to fulfill the query (mutation/subscription).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(rawEnums map[string][]string, qms ...interface{}) (string, error)

Build generates a string containing a GraphQL schema. The 1st parameter (rawEnums) is a map of enums where each map entry is a slice of

strings - each string is an enum value opt. followed by hash (#) and a description.
It can be nil if no enums are needed.

The 2nd, 3rd and 4th parameters represent the root query, mutation and subscription.

Each struct is scanned for public fields (scalars, nested structs, etc) to be used
as queries.  They can be nil if not implemented.

func MustBuild

func MustBuild(qms ...interface{}) string

MustBuild is the same as Build but panics on error

Types

type EntryPoint

type EntryPoint int

EntryPoint is an "enumeration" for the 3 different types of GraphQL entry point (query, mutation, subscription)

const (
	Query EntryPoint = iota
	Mutation
	Subscription
)

Jump to

Keyboard shortcuts

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