astprinter

package
v2.0.0-rc.112 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: MIT Imports: 6 Imported by: 3

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 *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 *ast.Document, indent []byte, out io.Writer) error

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

func PrintIndentDebug

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

func PrintString

func PrintString(document *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 *ast.Document, indent string) (string, error)

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

func PrintStringIndentDebug

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

PrintStringIndentDebug is the same as PrintStringIndent but prints debug information

Types

type Printer

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

Printer walks a GraphQL document and prints it as a string

func NewPrinter

func NewPrinter(indent []byte) *Printer

func (*Printer) Print

func (p *Printer) Print(document *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