internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

Buffer is light bytes.Buffer wrapper to make it easier to write string lines that include parameters.

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) C

func (b *Buffer) C(vs ...string)

C writes the content with P as a code comment.

func (*Buffer) P

func (b *Buffer) P(vs ...string)

P writes all strings as a single line ending in a newline.

type Generator

type Generator interface {
	Generate(p *protogen.Plugin) error
}

Generator represents the stateful code generation logic.

type GeneratorVisitor

type GeneratorVisitor struct {
	Visitors []VisitorFactory
}

GeneratorVisitor uses a set of Visitor implementations to perform code generation.

func (*GeneratorVisitor) Generate

func (g *GeneratorVisitor) Generate(p *protogen.Plugin) error

type Visitor

type Visitor interface {
	VisitFile(v *protogen.File) string
	VisitService(v *protogen.Service) string
	VisitMethod(v *protogen.Method) string
}

Visitor implementations generate code from protogen types.

func NewVisitorDescriptor

func NewVisitorDescriptor(f *protogen.GeneratedFile) Visitor

NewVisitorDescriptor implements VisitorFactory for VisitorDescriptor.

type VisitorDescriptor

type VisitorDescriptor struct {
	F *protogen.GeneratedFile
}

VisitorDescriptor implements Visitor by exporting gRPC service descriptors.

func (*VisitorDescriptor) VisitFile

func (vis *VisitorDescriptor) VisitFile(v *protogen.File) string

func (*VisitorDescriptor) VisitMethod

func (vis *VisitorDescriptor) VisitMethod(v *protogen.Method) string

func (*VisitorDescriptor) VisitService

func (vis *VisitorDescriptor) VisitService(v *protogen.Service) string

type VisitorFactory

type VisitorFactory func(F *protogen.GeneratedFile) Visitor

VisitorFactory binds the local code generation state to a visitor.

Jump to

Keyboard shortcuts

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