lib

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRelPath

func GetRelPath(absPath string) (*string, error)

func Merge

func Merge(indent string, paths ...string) *string

Merge func to merge all the GraphQL files Arguments: - indent string : the padding to generate schema eg. "\t" or " " - paths : A relative path to find *.graphql or *.gql files recursively

Types

type Arg

type Arg struct {
	Param      string
	Type       string
	TypeExt    *string // in case of enum e.g. admin(role: Role = ADMIN): Admin!
	Null       bool
	IsList     bool
	IsListNull bool
}

func ParseArgument

func ParseArgument(l *Lexer) []*Arg

type BaseFileInfo

type BaseFileInfo struct {
	Filename string
	Line     int
	Column   int
}

type Directive

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

type Enum

type Enum struct {
	BaseFileInfo
	Name   string
	Fields []string
}

type Input

type Input struct {
	BaseFileInfo
	Name  string
	Props []*Prop
}

type Interface

type Interface struct {
	BaseFileInfo
	Name  string
	Props []*Prop
}

type Lexer

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

func NewLexer

func NewLexer(file *os.File) *Lexer

func (*Lexer) ConsumeComment

func (l *Lexer) ConsumeComment()

func (*Lexer) ConsumeDirective

func (l *Lexer) ConsumeDirective()

func (*Lexer) ConsumeIdent

func (l *Lexer) ConsumeIdent() string

func (*Lexer) ConsumeMultiLineComment

func (l *Lexer) ConsumeMultiLineComment()

func (*Lexer) ConsumeToken

func (l *Lexer) ConsumeToken(expected rune)

func (*Lexer) ConsumeWhitespace

func (l *Lexer) ConsumeWhitespace()

func (*Lexer) GetBuffer

func (l *Lexer) GetBuffer() string

func (*Lexer) Peek

func (l *Lexer) Peek() rune

type MergedSchema

type MergedSchema struct {
	Indent string
	// contains filtered or unexported fields
}

func (*MergedSchema) StitchSchema

func (ms *MergedSchema) StitchSchema(s *Schema) string

type Mutation

type Mutation struct {
	BaseFileInfo
	Name      string
	Args      []*Arg
	Resp      Resp
	Directive *Directive
}

type Prop

type Prop struct {
	Name       string
	Args       []*Arg // in case of having args e.g. city(page: Pagination): String
	Type       string
	Null       bool
	IsList     bool
	IsListNull bool
	Directive  *Directive
}

type Query

type Query struct {
	BaseFileInfo
	Name      string
	Args      []*Arg
	Resp      Resp
	Directive *Directive
}

type Resp

type Resp struct {
	Name       string
	Null       bool
	IsList     bool
	IsListNull bool
}

type Scalar

type Scalar struct {
	BaseFileInfo
	Name string
}

type Schema

type Schema struct {
	Files         []*os.File
	Mutations     []*Mutation
	Queries       []*Query
	Subscriptions []*Subscription
	TypeNames     []*TypeName
	Scalars       []*Scalar
	Enums         []*Enum
	Interfaces    []*Interface
	Unions        []*Union
	Inputs        []*Input
}

func (*Schema) GetSchema

func (sc *Schema) GetSchema(path string)

GetSchema is to parse ./schema/**/*.graphql

func (*Schema) ParseSchema

func (s *Schema) ParseSchema(l *Lexer)

func (*Schema) Persist

func (sc *Schema) Persist(path string) error

func (*Schema) UniqueEnum

func (s *Schema) UniqueEnum(wg *sync.WaitGroup)

func (*Schema) UniqueInput

func (s *Schema) UniqueInput(wg *sync.WaitGroup)

func (*Schema) UniqueInterface

func (s *Schema) UniqueInterface(wg *sync.WaitGroup)

func (*Schema) UniqueMutation

func (s *Schema) UniqueMutation(wg *sync.WaitGroup)

func (*Schema) UniqueQuery

func (s *Schema) UniqueQuery(wg *sync.WaitGroup)

func (*Schema) UniqueScalar

func (s *Schema) UniqueScalar(wg *sync.WaitGroup)

func (*Schema) UniqueSubscription

func (s *Schema) UniqueSubscription(wg *sync.WaitGroup)

func (*Schema) UniqueTypeName

func (s *Schema) UniqueTypeName(wg *sync.WaitGroup)

func (*Schema) UniqueUnion

func (s *Schema) UniqueUnion(wg *sync.WaitGroup)

type Subscription

type Subscription struct {
	BaseFileInfo
	Name      string
	Args      []*Arg
	Resp      Resp
	Directive *Directive
}

type TypeName

type TypeName struct {
	BaseFileInfo
	Name      string
	Impl      bool
	ImplType  *string // deprecated, use ImplTypes
	ImplTypes []string
	Props     []*Prop
}

type Union

type Union struct {
	BaseFileInfo
	Name   string
	Fields []string
}

Jump to

Keyboard shortcuts

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