cosmosbuf

package
v28.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidCommand indicates an invalid command name.
	ErrInvalidCommand = errors.New("invalid command name")

	// ErrProtoFilesNotFound indicates that no ".proto" files were found.
	ErrProtoFilesNotFound = errors.New("no proto files found")
)

Functions

This section is empty.

Types

type Buf

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

Buf represents the buf application structure.

func New

func New(cacheStorage cache.Storage, goModPath string) (Buf, error)

New creates a new Buf based on the installed binary.

func (Buf) Export

func (b Buf) Export(ctx context.Context, protoDir, output string) error

Export runs the buf Export command for the files in the proto directory.

func (Buf) Generate

func (b Buf) Generate(
	ctx context.Context,
	protoPath,
	output,
	template string,
	options ...GenOption,
) (err error)

Generate runs the buf Generate command for each file into the proto directory.

func (Buf) Update

func (b Buf) Update(ctx context.Context, modDir string) error

Update updates module dependencies. By default updates all dependencies unless one or more dependencies are specified.

type Command

type Command string

Command represents a high level command under buf.

const (

	// CMDGenerate generate command.
	CMDGenerate Command = "generate"
	CMDExport   Command = "export"
	CMDDep      Command = "dep"
)

func (Command) String

func (c Command) String() string

String returns the command name.

type GenOption added in v28.5.0

type GenOption func(*genOptions)

GenOption configures code generation.

func ExcludeFiles added in v28.5.0

func ExcludeFiles(patterns ...string) GenOption

ExcludeFiles exclude file names from the generate command using glob.

func FileByFile added in v28.5.0

func FileByFile() GenOption

FileByFile runs the generate command for each proto file.

func IncludeImports added in v28.5.0

func IncludeImports() GenOption

IncludeImports also generate all imports except for Well-Known Types.

func IncludeWKT added in v28.5.0

func IncludeWKT() GenOption

IncludeWKT also generate Well-Known Types. Cannot be set without IncludeImports.

func WithFlag added in v28.5.0

func WithFlag(flag, value string) GenOption

WithFlag provides flag options for the buf generate command.

Jump to

Keyboard shortcuts

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