internal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const GeneratedCommentMarker = "// Code generated by https://github.com/crombird/minigen. DO NOT EDIT."
View Source
const IntrospectionQueryString = `` /* 1116-byte string literal not displayed */

Variables

This section is empty.

Functions

func BuildClientSchema

func BuildClientSchema(introspection IntrospectionQuery) (graphql.Schema, error)

func GeneratePackage

func GeneratePackage(
	schema *graphql.Schema,
	definitions *ClientDefinitions,
	packageName string,
	scalarMap map[string]string,
	scalarRefHelpers bool,
	nullableInputTypes bool,
) ([]byte, error)

Generate a golang file based on a remote schema and a bunch of named operations and fragments.

Types

type ClientDefinitions

type ClientDefinitions struct {
	Operations map[string]*graphqlAst.OperationDefinition
	Fragments  map[string]*graphqlAst.FragmentDefinition
}

func ExtractFromPackage

func ExtractFromPackage(directory string) (ClientDefinitions, error)

type FieldType

type FieldType struct {
	Name              string
	Description       string
	Args              []InputValueFragment
	Type              *TypeRefFragment
	IsDeprecated      bool
	DeprecationReason string
}

type FullTypeFragment

type FullTypeFragment struct {
	Kind        TypeKind
	Name        string
	Description string
	Fields      []FieldType
	InputFields []InputValueFragment
	Interfaces  []TypeRefFragment
	EnumValues  []struct {
		Name              string
		Description       string
		IsDeprecated      bool
		DeprecationReason string
	}
	PossibleTypes []TypeRefFragment
}

type InputValueFragment

type InputValueFragment struct {
	Name         string
	Description  string
	Type         TypeRefFragment
	DefaultValue string
}

type IntrospectionQuery

type IntrospectionQuery struct {
	Schema struct {
		QueryType        *struct{ Name string }
		MutationType     *struct{ Name string }
		SubscriptionType *struct{ Name string }
		Types            []FullTypeFragment
	} `json:"__schema"`
}

type TypeKind

type TypeKind string
const (
	TypeKindScalar      TypeKind = "SCALAR"
	TypeKindObject      TypeKind = "OBJECT"
	TypeKindInterface   TypeKind = "INTERFACE"
	TypeKindUnion       TypeKind = "UNION"
	TypeKindEnum        TypeKind = "ENUM"
	TypeKindInputObject TypeKind = "INPUT_OBJECT"
	TypeKindList        TypeKind = "LIST"
	TypeKindNonNull     TypeKind = "NON_NULL"
)

type TypeRefFragment

type TypeRefFragment struct {
	Kind   TypeKind
	Name   string
	OfType *TypeRefFragment
}

Jump to

Keyboard shortcuts

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