graphql

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 8 Imported by: 0

README

GoDoc

graphql parser in Go

This is experimental.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments map[string]Value

func (Arguments) String

func (a Arguments) String() string

type BooleanValue

type BooleanValue bool

func (BooleanValue) MarshalJSON

func (v BooleanValue) MarshalJSON() ([]byte, error)

func (BooleanValue) String

func (v BooleanValue) String() string

type Directive

type Directive struct {
	Directive string
	Arguments Arguments
}

func (*Directive) String

func (d *Directive) String() string

type Directives

type Directives []*Directive

func (Directives) String

func (ds Directives) String() string

type Document

type Document struct {
	Operations map[string]*Operation `json:"operations"`
	Fragments  map[string]*Fragment  `json:"fragments,omitempty"`
}

func Parse

func Parse(v string) (*Document, error)

func (*Document) String

func (d *Document) String() string

type EnumValue

type EnumValue string

func (EnumValue) MarshalJSON

func (v EnumValue) MarshalJSON() ([]byte, error)

func (EnumValue) String

func (v EnumValue) String() string

type Field

type Field struct {
	Alias        string       `json:"alias,omitempty"`
	Name         string       `json:"name"`
	Arguments    Arguments    `json:"arguments,omitempty"`
	Directives   Directives   `json:"directives,omitempty"`
	SelectionSet SelectionSet `json:"selection_set,omitempty"`
}

func (*Field) MarshalJSON

func (f *Field) MarshalJSON() ([]byte, error)

func (*Field) String

func (f *Field) String() string

type Fragment

type Fragment struct {
	Name          string         `json:"name"`
	TypeCondition *TypeCondition `json:"type_condition,omitempty"`
	Directives    Directives     `json:"directives,omitempty"`
	SelectionSet  SelectionSet   `json:"selection_set"`
}

func (*Fragment) String

func (f *Fragment) String() string

type FragmentSpread

type FragmentSpread struct {
	Name       string     `json:"selection_set"`
	Directives Directives `json:"directives,omitempty"`
}

func (*FragmentSpread) MarshalJSON

func (f *FragmentSpread) MarshalJSON() ([]byte, error)

func (*FragmentSpread) String

func (f *FragmentSpread) String() string

type InlineFragment

type InlineFragment struct {
	TypeCondition *TypeCondition `json:"type_condition,omitempty"`
	Directives    Directives     `json:"directives,omitempty"`
	SelectionSet  SelectionSet   `json:"selection_set"`
}

func (*InlineFragment) MarshalJSON

func (f *InlineFragment) MarshalJSON() ([]byte, error)

func (*InlineFragment) String

func (i *InlineFragment) String() string

type NullValue

type NullValue struct{}

func (NullValue) MarshalJSON

func (v NullValue) MarshalJSON() ([]byte, error)

func (NullValue) String

func (v NullValue) String() string

type Operation

type Operation struct {
	OperationType       OperationType       `json:"type"`
	Name                string              `json:"name"` // optional
	VariableDefinitions VariableDefinitions `json:"variable_definitions,omitempty"`
	Directives          Directives          `json:"directives,omitempty"`
	SelectionSet        SelectionSet        `json:"selection_set"`
}

func (*Operation) String

func (op *Operation) String() string

type OperationType

type OperationType int
const (
	Query        OperationType = iota // query – a read‐only fetch.
	Mutation                          // mutation – a write followed by a fetch.
	Subscription                      // subscription – a long‐lived request that fetches data in response to source events.
)

func (OperationType) MarshalJSON

func (o OperationType) MarshalJSON() ([]byte, error)

func (OperationType) String

func (o OperationType) String() string

type Parser

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

type Selection

type Selection interface {
	// TODO
	String() string
}

type SelectionSet

type SelectionSet []Selection

func (SelectionSet) String

func (s SelectionSet) String() string

type StringValue

type StringValue string

func (StringValue) MarshalJSON

func (s StringValue) MarshalJSON() ([]byte, error)

func (StringValue) String

func (s StringValue) String() string

type Token

type Token interface {
	String() string
}

type TypeCondition

type TypeCondition struct {
	NamedType string // "on X"
}

func (*TypeCondition) String

func (t *TypeCondition) String() string

type Value

type Value interface {
	// TODO
	String() string
}

type VariableDefinition

type VariableDefinition struct {
	Variable     string
	Type         string
	DefaultValue Value // optional
}

type VariableDefinitions

type VariableDefinitions []*VariableDefinition

func (VariableDefinitions) String

func (v VariableDefinitions) String() string

type VariableValue

type VariableValue struct {
	Var string
}

func (*VariableValue) MarshalJSON

func (v *VariableValue) MarshalJSON() ([]byte, error)

func (*VariableValue) String

func (v *VariableValue) String() string

Jump to

Keyboard shortcuts

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