Documentation
¶
Index ¶
- Constants
- func DefaultNameGenerator(packageName, typeName string) string
- func Generate()
- func NormalizedFileName(s string) string
- type Extern
- type GQLIdent
- type GQLType
- type Generator
- type MapEntry
- type ObjectField
- type Option
- type Options
- type Printer
- type Symbol
- type SymbolTable
- type TypeInfo
- type TypeNameGenerator
- type UnionField
- type Visitor
Constants ¶
View Source
const ( OptionGraphQL string = "(graphql.type)" ImportPrefixOption = "import_prefix" ImportPathOption = "import_path" )
Variables ¶
This section is empty.
Functions ¶
func DefaultNameGenerator ¶
DefaultNameGenerator is a default type name generator
func NormalizedFileName ¶
Types ¶
type Generator ¶
type Generator interface {
FromProto(*descriptorpb.FileDescriptorProto, string, string) (bool, error)
GetFieldType(*descriptorpb.DescriptorProto, *descriptorpb.FieldDescriptorProto, string) *TypeInfo
GetObjectFields(*descriptorpb.DescriptorProto) *ObjectField
GetProtobufFieldName(string) string
GetInputType(string) string
GetOutputType(string) string
GetEnumType(string) string
GetLanguageType(string) string
GetGraphQLTypeName(string) string
GetExternal(string) (*Extern, bool)
HasOperation() bool
}
Generator is an interface of graphql code generator
func NewGenerator ¶
func NewGenerator(typeNameGenerator TypeNameGenerator, baseFileName string, options Options) Generator
type ObjectField ¶
type ObjectField struct {
Fields []*descriptorpb.FieldDescriptorProto
Unions map[string][]*descriptorpb.FieldDescriptorProto
Maps []*descriptorpb.FieldDescriptorProto
MapTypes map[string]MapEntry
HasFields bool
}
type SymbolTable ¶ added in v0.0.2
type SymbolTable struct {
// contains filtered or unexported fields
}
func (*SymbolTable) Append ¶ added in v0.0.2
func (t *SymbolTable) Append(s *Symbol)
func (*SymbolTable) Exist ¶ added in v0.0.2
func (t *SymbolTable) Exist(ident GQLIdent) bool
type TypeInfo ¶
type TypeNameGenerator ¶
TypeNameGenerator is function type to generate GraphQL type from protobuf object type
type UnionField ¶
type UnionField struct {
Message *descriptorpb.DescriptorProto
Field *descriptorpb.FieldDescriptorProto
}
type Visitor ¶ added in v0.0.2
type Visitor interface {
Content() ([]byte, error)
Visit(parent *Symbol, f *protogen.File)
VisitEnum(parent *Symbol, enumDescriptor *protogen.Enum)
VisitMessage(parent *Symbol, p *protogen.Message, typ GQLType)
VisitField(symbol *Symbol, p *protogen.Field, typ GQLType)
VisitOneOf(symbol *Symbol, p *protogen.Oneof, typ GQLType)
VisitService(symbol *Symbol, p *protogen.Service)
}
func NewVisitor ¶ added in v0.0.2
Click to show internal directories.
Click to hide internal directories.