cosmosbuf

package
v29.0.0-...-a2903dc Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 13 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() (Buf, error)

New creates a new Buf based on the installed binary.

func (Buf) Cleanup

func (b Buf) Cleanup() error

Cleanup deletes temporary files and directories.

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,
	protoDir,
	output,
	template string,
	excludeFilename ...string,
) (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, dependencies ...string) error

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

type BufWork

type BufWork struct {
	Version     string   `yaml:"version"`
	Directories []string `yaml:"directories"`
	// contains filtered or unexported fields
}

BufWork represents the buf.work.yaml file.

func ParseBufWork

func ParseBufWork(appPath string) (BufWork, error)

ParseBufWork parse the buf.work.yaml file at app path.

func (BufWork) AddProtoDir

func (w BufWork) AddProtoDir(newPath string) error

AddProtoDir add a proto directory path from the buf work file.

func (BufWork) HasProtoDir

func (w BufWork) HasProtoDir(path string) bool

HasProtoDir returns true if the proto path exist into the directories slice.

func (BufWork) MissingDirectories

func (w BufWork) MissingDirectories() ([]string, error)

MissingDirectories check if the directories inside the buf work exist.

func (BufWork) RemoveProtoDirs

func (w BufWork) RemoveProtoDirs(paths ...string) error

RemoveProtoDirs remove a list a proto directory paths from the buf work file.

type Command

type Command string

Command represents a high level command under buf.

const (

	// CMDGenerate generate command.
	CMDGenerate Command = "generate"
	CMDExport   Command = "export"
	CMDMod      Command = "mod"
)

func (Command) String

func (c Command) String() string

String returns the command name.

Jump to

Keyboard shortcuts

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