appproto

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package appproto contains helper functionality for protoc plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(
	ctx context.Context,
	f func(
		ctx context.Context,
		container app.EnvStderrContainer,
		responseWriter ResponseWriter,
		request *pluginpb.CodeGeneratorRequest,
	),
)

Main runs the application using the OS Container and calling os.Exit on the return value of Run.

func Run

func Run(
	ctx context.Context,
	container app.Container,
	f func(
		ctx context.Context,
		container app.EnvStderrContainer,
		responseWriter ResponseWriter,
		request *pluginpb.CodeGeneratorRequest,
	),
) error

Run runs the application using the container.

Types

type ResponseWriter

type ResponseWriter interface {
	// WriteCodeGeneratorResponseFile adds the file to the response.
	//
	// Can be called multiple times.
	WriteCodeGeneratorResponseFile(*pluginpb.CodeGeneratorResponse_File)
	// WriteError writes the error to the response.
	//
	// Can be called multiple times. Errors will be concatenated by newlines.
	// Resulting error string will have spaces trimmed before creating the response.
	WriteError(string)
}

ResponseWriter is a response writer.

Not thread-safe.

Jump to

Keyboard shortcuts

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