internal

package
v0.0.0-...-2f50b3c Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NAME    = "protoc-gen-graphql"
	VERSION = "v0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	// Sets the code gen target
	Target string
	// If true, keep the casing for type fields. Else fields will be converted to camel case
	KeepCase bool
	// If true, keeps the prefix in type names
	KeepPrefix bool
	// If true, combines the output file to one single file
	CombineOutput bool
	// Sets custom output file names
	OutputFileNames []string
	// Wether to suffix or prefix input names. Suffixing the word 'Input' is the default behavior
	InputNaming string
	// What to prefix or suffix with the input type names.
	// Word 'Input' is default for suffix and letter 'I' is default for prefix
	Affix string
	// If true, generate schema against all the files explicitly listed in the command line
	// and everything they import. Default to false
	All bool
}

func ParseArgs

func ParseArgs(params string, logger *Logger) *Args

type Logger

type Logger struct {
	*log.Logger
}

func NewLogger

func NewLogger() *Logger

func (*Logger) Log

func (l *Logger) Log(format string, v ...interface{})

type Plugin

type Plugin struct {
	Request  *pluginpb.CodeGeneratorRequest
	Response *pluginpb.CodeGeneratorResponse
	// contains filtered or unexported fields
}

func New

func New(request *pluginpb.CodeGeneratorRequest) *Plugin

New creates a new Plugin

func (*Plugin) Error

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

Prints an error, and exits.

func (*Plugin) Execute

func (plugin *Plugin) Execute()

Generates the protoc response

func (*Plugin) Info

func (p *Plugin) Info(msg ...string)

Prints a message

func (*Plugin) SetSupportOptionalField

func (plugin *Plugin) SetSupportOptionalField()

Sets the support optional field option

func (*Plugin) Version

func (p *Plugin) Version() string

type Schema

type Schema struct {
	*strings.Builder
	// contains filtered or unexported fields
}

func CreateSchema

func CreateSchema(protoFile *descriptorpb.FileDescriptorProto) *Schema

Creates new Schema

func (*Schema) Comment

func (schema *Schema) Comment(s string)

Puts a graphql comment in the generated content

func (*Schema) FileName

func (schema *Schema) FileName(filename *string)

Creates a file name based on the given proto file name

func (*Schema) Mutations

func (schema *Schema) Mutations()

Constructs mutations from service methods and fills the schema.mutations

func (*Schema) NewLine

func (schema *Schema) NewLine(length ...int)

Puts a new line in the generated content

func (*Schema) Print

func (schema *Schema) Print(msg ...string)

Prints a message

func (*Schema) Queries

func (schema *Schema) Queries()

Constructs the Object types from message types and fills the schema.objectTypes

func (*Schema) Space

func (schema *Schema) Space(length ...int)

Adds a space to the generated content

func (*Schema) Write

func (schema *Schema) Write(s string)

Write writes a string to the string builder

func (*Schema) WriteHeader

func (schema *Schema) WriteHeader()

Write the header content

func (*Schema) WriteTypeName

func (schema *Schema) WriteTypeName(name *string)

Writes the type's name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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