plugin

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScalarBytes      = "Bytes"
	ScalarFloat32    = "Float32"
	ScalarInt64      = "Int64"
	ScalarInt32      = "Int32"
	ScalarUint32     = "Uint32"
	ScalarUint64     = "Uint64"
	ScalarAny        = "Any"
	ScalarDirective  = "__Directive"
	ScalarType       = "__Type"
	ScalarField      = "__Field"
	ScalarEnumValue  = "__EnumValue"
	ScalarInputValue = "__InputValue"
	ScalarSchema     = "__Schema"
	ScalarInt        = "Int"
	ScalarFloat      = "Float"
	ScalarString     = "String"
	ScalarBoolean    = "Boolean"
	ScalarID         = "ID"
)

Variables

This section is empty.

Functions

func GetGqlFieldOptions

func GetGqlFieldOptions(field *descriptor.FieldDescriptorProto) *gql.Field

func ToLowerFirst

func ToLowerFirst(s string) string

Types

type Callstack

type Callstack interface {
	Push(entry string)
	Pop(entry string)
	Has(entry string) bool
	Free()
	List() []string
}

func NewCallstack

func NewCallstack() Callstack

type Method

type Method struct {
	Name         string
	InputType    string
	OutputType   string
	Phony        bool
	ServiceIndex int
	Index        int
}

type Methods

type Methods []*Method

func (Methods) NameExists

func (ms Methods) NameExists(name string) bool

type ModelDescriptor

type ModelDescriptor struct {
	BuiltIn     bool
	PackageDir  string
	TypeName    string
	UsedAsInput bool
	Index       int
	OneofTypes  map[string]struct{}
	// contains filtered or unexported fields
}

type OneofRef

type OneofRef struct {
	Parent *Type
	Index  int32
}

type Plugin

type Plugin struct {
	*generator.Generator
	// contains filtered or unexported fields
}

func NewPlugin

func NewPlugin() *Plugin

func (*Plugin) Enums

func (p *Plugin) Enums() map[string]*Type

func (*Plugin) Error

func (p *Plugin) Error(err error, msgs ...string)

func (*Plugin) FillTypeMap

func (p *Plugin) FillTypeMap(typeName string, messages map[string]*Type, inputField bool)

recursively goes trough all fields of the types from messages map and fills it with child types. i. e. if message Type1 { Type2: field1 = 1; } exists in the map this function will look up Type2 and add Type2 to the map as well

func (*Plugin) GetOneof

func (p *Plugin) GetOneof(ref OneofRef) *Type

func (*Plugin) GetSchemaByIndex

func (p *Plugin) GetSchemaByIndex(index int) *bytes.Buffer

func (*Plugin) GqlModelNames

func (p *Plugin) GqlModelNames() map[*Type]string

func (*Plugin) GraphQLType

func (p *Plugin) GraphQLType(field *descriptor.FieldDescriptorProto, messagesIn map[string]*Type) string

func (*Plugin) In

func (p *Plugin) In()

func (*Plugin) InitFile

func (p *Plugin) InitFile(file *generator.FileDescriptor)

func (*Plugin) Inputs

func (p *Plugin) Inputs() map[string]*Type

func (*Plugin) IsAny

func (p *Plugin) IsAny(typeName string) (ok bool)

func (*Plugin) IsEmpty

func (p *Plugin) IsEmpty(t *Type) bool

same isEmpty but for mortals

func (*Plugin) Maps

func (p *Plugin) Maps() map[string]*Type

func (*Plugin) Mutations

func (p *Plugin) Mutations() Methods

func (*Plugin) Oneofs

func (p *Plugin) Oneofs() map[string]*Type

func (*Plugin) Out

func (p *Plugin) Out()

func (*Plugin) P

func (p *Plugin) P(str ...interface{})

func (*Plugin) PrintComments

func (p *Plugin) PrintComments(path ...int) bool

func (*Plugin) Queries

func (p *Plugin) Queries() Methods

func (*Plugin) Scalars

func (p *Plugin) Scalars() map[string]*Type

func (*Plugin) Subscriptions

func (p *Plugin) Subscriptions() Methods

func (*Plugin) Types

func (p *Plugin) Types() map[string]*Type

func (*Plugin) Warn

func (p *Plugin) Warn(msgs ...interface{})

type TypeMapEntry

type TypeMapEntry struct {
	Key   string
	Value *Type
}

type TypeMapList

type TypeMapList []*TypeMapEntry

func TypeMap2List

func TypeMap2List(t map[string]*Type) (m TypeMapList)

func (TypeMapList) Len

func (t TypeMapList) Len() int

func (TypeMapList) Less

func (t TypeMapList) Less(i, j int) bool

func (TypeMapList) Swap

func (t TypeMapList) Swap(i, j int)

Jump to

Keyboard shortcuts

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