Documentation ¶
Index ¶
- Constants
- func GetGqlFieldOptions(field *descriptor.FieldDescriptorProto) *gql.Field
- func Params(gen *generator.Generator) map[string]string
- func SplitCamelCase(src string) (entries []string)
- func ToLowerFirst(s string) string
- type Callstack
- type Method
- type Methods
- type ModelDescriptor
- type OneofRef
- type Plugin
- func (p *Plugin) Enums() map[string]*Type
- func (p *Plugin) Error(err error, msgs ...string)
- func (p *Plugin) FillTypeMap(typeName string, messages map[string]*Type, inputField bool)
- func (p *Plugin) GetOneof(ref OneofRef) *Type
- func (p *Plugin) GetSchemaByIndex(index int) *bytes.Buffer
- func (p *Plugin) GqlModelNames() map[*Type]string
- func (p *Plugin) GraphQLType(field *descriptor.FieldDescriptorProto, messagesIn map[string]*Type) string
- func (p *Plugin) In()
- func (p *Plugin) InitFile(file *generator.FileDescriptor)
- func (p *Plugin) Inputs() map[string]*Type
- func (p *Plugin) IsAny(typeName string) (ok bool)
- func (p *Plugin) IsEmpty(t *Type) bool
- func (p *Plugin) Maps() map[string]*Type
- func (p *Plugin) Mutations() Methods
- func (p *Plugin) Oneofs() map[string]*Type
- func (p *Plugin) Out()
- func (p *Plugin) P(str ...interface{})
- func (p *Plugin) PrintComments(path ...int) bool
- func (p *Plugin) Queries() Methods
- func (p *Plugin) Scalars() map[string]*Type
- func (p *Plugin) Subscriptions() Methods
- func (p *Plugin) Types() map[string]*Type
- func (p *Plugin) Warn(msgs ...interface{})
- type Type
- type TypeMapEntry
- type TypeMapList
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 SplitCamelCase ¶
Split splits the camelcase word and returns a list of words. It also supports digits. Both lower camel case and upper camel case are supported. For more info please check: http://en.wikipedia.org/wiki/CamelCase
Examples
"" => [""] "lowercase" => ["lowercase"] "Class" => ["Class"] "MyClass" => ["My", "Class"] "MyC" => ["My", "C"] "HTML" => ["HTML"] "PDFLoader" => ["PDF", "Loader"] "AString" => ["A", "String"] "SimpleXMLParser" => ["Simple", "XML", "Parser"] "vimRPCPlugin" => ["vim", "RPC", "Plugin"] "GL11Version" => ["GL", "11", "Version"] "99Bottles" => ["99", "Bottles"] "May5" => ["May", "5"] "BFG9000" => ["BFG", "9000"] "BöseÜberraschung" => ["Böse", "Überraschung"] "Two spaces" => ["Two", " ", "spaces"] "BadUTF8\xe2\xe2\xa1" => ["BadUTF8\xe2\xe2\xa1"]
Splitting rules
- If string is not valid UTF-8, return it without splitting as single item array.
- Assign all unicode characters into one of 4 sets: lower case letters, upper case letters, numbers, and all other characters.
- Iterate through characters of string, introducing splits between adjacent characters that belong to different sets.
- Iterate through array of split strings, and if a given string is upper case: if subsequent string is lower case: move last character of upper case string to beginning of lower case string
func ToLowerFirst ¶
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 *descriptor.MethodDescriptorProto *descriptor.ServiceDescriptorProto }
type ModelDescriptor ¶
type Plugin ¶
func (*Plugin) FillTypeMap ¶
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) GqlModelNames ¶
func (*Plugin) GraphQLType ¶
func (p *Plugin) GraphQLType(field *descriptor.FieldDescriptorProto, messagesIn map[string]*Type) string
func (*Plugin) InitFile ¶
func (p *Plugin) InitFile(file *generator.FileDescriptor)
func (*Plugin) PrintComments ¶
func (*Plugin) Subscriptions ¶
type Type ¶
type Type struct { *descriptor.DescriptorProto *descriptor.EnumDescriptorProto ModelDescriptor }
type TypeMapEntry ¶
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)
Click to show internal directories.
Click to hide internal directories.