astprinter

package
v1.60.3 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MIT Imports: 5 Imported by: 5

Documentation

Overview

Package astprinter takes a GraphQL document and prints it as a String with optional indentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Print

func Print(document, definition *ast.Document, out io.Writer) error

Print takes a document as well as a definition (optional) and prints it to the io.Writer. The definition is only necessary in case a GraphQL Operation should be printed.

func PrintIndent

func PrintIndent(document, definition *ast.Document, indent []byte, out io.Writer) error

PrintIndent is the same as Print but accepts an additional indent parameter to set indentation.

func PrintString

func PrintString(document, definition *ast.Document) (string, error)

PrintString is the same as Print but returns a string instead of writing to an io.Writer

func PrintStringIndent

func PrintStringIndent(document, definition *ast.Document, indent string) (string, error)

PrintStringIndent is the same as PrintIndent but returns a string instead of writing to an io.Writer

Types

type Printer

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

Printer walks a GraphQL document and prints it as a string

func (*Printer) Print

func (p *Printer) Print(document, definition *ast.Document, out io.Writer) error

Print starts the actual AST printing Keep a printer and re-use it in case you'd like to print ASTs in the hot path.

Jump to

Keyboard shortcuts

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