parse

package
v0.0.0-...-8b81d4d Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

You can use the "packr clean" command to clean up this, and any other packr generated files.

Index

Constants

View Source
const (
	ModelFileName    = "/models.go"
	FunctionFileName = "/generated.go"
	EnumFileName     = "/enums.go"
	SchemaName       = "/dgraph_schema.graphql"
	CustomsFileName  = "/customs.go"
)

Variables

This section is empty.

Functions

func Parse

func Parse(config *Config)

Parse parses the directory input and outputs go files to the directory output.

Types

type Config

type Config struct {
	//Deprecated.
	State string
	//Input directory.
	Input string
	//Output directory.
	Output string
	//Package name.
	Package string
}

type Creator

type Creator interface {
	Create(i *Generator, w io.Writer)
}

type EnumCreator

type EnumCreator struct{}

EnumCreator is the creator for the enum file.

func (EnumCreator) Create

func (e EnumCreator) Create(i *Generator, w io.Writer)

type EnumResult

type EnumResult struct {
	Vals []EnumValues
}

type EnumValues

type EnumValues struct {
	Name   string
	Start  string
	Fields []string
}

type Field

type Field struct {
	//For  DB name.
	Tag string
	//This include omitempty for instance. it is related to the tag.
	WrittenTag string
	//Name for the field.
	Name string
	//What type is this field? String etc.
	Type string

	//like []*string. Used in templates.
	TypeLabel string
	//did this come from the field or from the interface?
	FromInterface bool
	Nosave        bool
	Directives    []*common.Directive
	Nofield       bool
	//For templates.
	Parent  string
	IsArray bool
	// contains filtered or unexported fields
}

Field represents the parsed graphQL field alongside all definitions needed for generation.

func (*Field) HasDirective

func (f *Field) HasDirective(name string) *common.Directive

func (*Field) IsScalar

func (f *Field) IsScalar() bool

type FnCreator

type FnCreator struct {
	Fields map[string][]Field
}

func (FnCreator) Create

func (f FnCreator) Create(i *Generator, w io.Writer)

type Generator

type Generator struct {

	//To set states from certain function
	States map[string]interface{}
	// contains filtered or unexported fields
}

Generator handles the state of the entire generation.

func (*Generator) Run

func (g *Generator) Run()

type ModelCreator

type ModelCreator struct{}

func (ModelCreator) Create

func (m ModelCreator) Create(i *Generator, w io.Writer)

type Object

type Object struct {
	Fields    []Field
	AllFields []Field
	Type      objectType
}

Jump to

Keyboard shortcuts

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