generator

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "v0.4.6"

Variables

View Source
var ScalarMap = map[string]string{
	"ID":      "string",
	"String":  "string",
	"Int":     "int",
	"Float":   "float64",
	"Boolean": "bool",
}

Functions

func NewSource

func NewSource(name, schemaString string) *ast.Source

Types

type Argument added in v0.2.1

type Argument struct {
	Name string
	Type string
}

type Enum

type Enum struct {
	Description string
	Name        string
	Values      []*EnumValue
}

type EnumValue

type EnumValue struct {
	Description string
	Name        string
}

type Field

type Field struct {
	Description string
	Name        string
	Type        string
	NonNull     bool
	Tag         string
}

type Generator

type Generator struct {
	Version           string
	PackageName       string
	GenHeaderComments bool
	Sources           []*ast.Source
	Schema            *ast.Schema
	Models            *Models
	ServiceName       string
	// TODO move to models
	Imports    map[string]string // package->alias
	Query      *Query
	Enums      []*Enum
	Interfaces []*Interface
}

func NewGenerator added in v0.1.1

func NewGenerator(o Options) *Generator

func (*Generator) AddSource

func (g *Generator) AddSource(name, content string)

func (*Generator) Generate

func (g *Generator) Generate() (string, error)

func (*Generator) GoDoc

func (g *Generator) GoDoc(name, desc string) string

func (*Generator) GoName

func (g *Generator) GoName(name string) string

func (*Generator) LoadSchema

func (g *Generator) LoadSchema() error

type Interface

type Interface struct {
	Description string
	Name        string
}

type Models

type Models struct {
	Objects []*Object
}

type Object

type Object struct {
	Description string
	Name        string
	Fields      []*Field
	Implements  []string
}

type Options added in v0.1.1

type Options struct {
	PackageName       string
	ServiceName       string
	GenHeaderComments bool
}

type Query

type Query struct {
	Resolvers []*Resolver
}

type Resolver

type Resolver struct {
	Name     string
	Type     string
	Argument *Argument
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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