pbspec

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

README

pbspec

pbspec is a Go package to load the Protocol Buffer Language (proto files) for code generation.

go get h12.io/pbspec

A CLI tool pbspec2json is provided for exporting the ProtoBuf file descriptor set into JSON for inspection.

Usage:

pbspec2json -IPATH1 -IPATH2 ... PROTO_FILES

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromJSON

func FromJSON(jsonBytes []byte) (*descriptorpb.FileDescriptorSet, error)

func Load

func Load(protocArgs []string) (*descriptorpb.FileDescriptorSet, error)

Load the descriptors in the proto files with the same command line arguments as protoc, e.g. -IPATH1 -IPATH2 ... PROTO_FILES

func ToJSON

func ToJSON(fileSet *descriptorpb.FileDescriptorSet) ([]byte, error)

Types

type EnumType

type EnumType struct {
	*descriptorpb.EnumDescriptorProto
}

type Field

type Field struct {
	*descriptorpb.FieldDescriptorProto
}

func (*Field) IsMessageType

func (f *Field) IsMessageType() bool

func (*Field) Repeated

func (f *Field) Repeated() bool

type MessageType

type MessageType struct {
	*descriptorpb.DescriptorProto
	File *descriptorpb.FileDescriptorProto
}

func (*MessageType) Fields

func (t *MessageType) Fields() []Field

func (*MessageType) GoPackage

func (t *MessageType) GoPackage() string

type TypeSet

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

func NewTypeSet

func NewTypeSet(fileSet *descriptorpb.FileDescriptorSet) (*TypeSet, error)

func (*TypeSet) GetEnumType

func (s *TypeSet) GetEnumType(longName string) (*EnumType, bool)

func (*TypeSet) GetMsgType

func (s *TypeSet) GetMsgType(longName string) (*MessageType, bool)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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