codegen

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateWorkspace

func GenerateWorkspace() error

Types

type GenerateCodeOption

type GenerateCodeOption func(*GenerateCodeOptions)

func WithGenerateStrategy

func WithGenerateStrategy(strategy GenerateStrategy) GenerateCodeOption

type GenerateCodeOptions

type GenerateCodeOptions struct {
	// contains filtered or unexported fields
}

type GenerateStrategy

type GenerateStrategy int
const (
	// Generates only workspace-local descriptors
	WorkspaceLocalDescriptorsOnly GenerateStrategy = iota
	// Generates all descriptors, including those from dependencies, except
	// package google.protobuf.
	AllDescriptorsExceptGoogleProtobuf
)

type GeneratedFile

type GeneratedFile struct {
	// Basename of the generated file.
	Name string
	// Path where this file can be written to, such that it will be in the same
	// directory as the source proto it was generated from. Calling WriteToDisk
	// will write the file to this path. This will be a relative path if
	// the source file was given as a relative path.
	SourceRelPath string
	// Go package (not including the file name) defined in the source proto.
	Package string
	// Generated file content.
	Content string
}

func GenerateCode

func GenerateCode(generators []Generator, searchDirs []string, opts ...GenerateCodeOption) ([]*GeneratedFile, error)

Generates code for each source file found in the given search directories, using one or more code generators.

func (*GeneratedFile) Read

func (g *GeneratedFile) Read(p []byte) (int, error)

func (*GeneratedFile) WriteToDisk

func (g *GeneratedFile) WriteToDisk() error

type Generator

type Generator interface {
	Name() string
	Generate(gen *protogen.Plugin) error
}

func DefaultGenerators

func DefaultGenerators() []Generator

Directories

Path Synopsis
generators
x/python Module

Jump to

Keyboard shortcuts

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