protobuf

package
v0.0.0-...-fa1582b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestProtoDescriptorSet = descriptorSetBase64
View Source
var TestProtoZip = testProtoZip

exports for API tests

Functions

This section is empty.

Types

type GenerateTarget

type GenerateTarget int
const (
	GenerateTargetCPP GenerateTarget
	GenerateTargetCSharp
	GenerateTargetJava
	GenerateTargetJavaNano
	GenerateTargetJS
	GenerateTargetObjC
	GenerateTargetPHP
	GenerateTargetPython
	GenerateTargetRuby
	GenerateTargetGo
)

type ProtoDependency

type ProtoDependency struct {
	URL      string   `json:"url,omitempty"`
	Revision string   `json:"revision,omitempty"`
	Path     string   `json:"path,omitempty"`
	Ignores  []string `json:"ignores,omitempty"`
}

type Protobuf

type Protobuf struct {
	ID           *string            `json:"id"`
	Name         *string            `json:"name"`
	Version      *string            `json:"version"`
	LastUpdated  time.Time          `json:"lastUpdated"`
	Dependencies []*ProtoDependency `json:"dependencies"`
	// contains filtered or unexported fields
}

Protobuf represents a single versioned protobuf package. It implements methods for utility functions across different packages. Storage and Database providers are responsible for setting, storing, and retrieving the raw data.

func (*Protobuf) CompileToDescriptorSet

func (p *Protobuf) CompileToDescriptorSet() error

func (*Protobuf) Contents

func (p *Protobuf) Contents(filename string) ([]byte, error)

func (*Protobuf) DescriptorBytes

func (p *Protobuf) DescriptorBytes() []byte

DescriptorBytes returns the descriptor set bytes for the protobuf object

func (*Protobuf) DescriptorReader

func (p *Protobuf) DescriptorReader() io.ReadSeeker

DescriptorReader returns a ReadSeeker for the raw desciptor set

func (*Protobuf) Descriptors

func (p *Protobuf) Descriptors() (*ProtobufDescriptors, error)

Descriptors returns the human-readable representation of the raw file descriptors for this object

func (*Protobuf) DocJSON

func (p *Protobuf) DocJSON(filename string) ([]byte, error)

func (Protobuf) GenerateTo

func (p Protobuf) GenerateTo(target GenerateTarget, prefix string) (tempOut string, rm func(), err error)

func (*Protobuf) GetDescriptors

func (p *Protobuf) GetDescriptors() (map[string]*desc.FileDescriptor, error)

GetDescriptors returns the raw file descriptors for a protobuf object This is primarily a helper for functions that return more human readable formats

func (*Protobuf) Raw

func (p *Protobuf) Raw() []byte

Raw returns the raw zip bytes of the protobuf object

func (*Protobuf) RawFilename

func (p *Protobuf) RawFilename() string

RawFilename returns a zip filename for the protobuf object

func (*Protobuf) RawReader

func (p *Protobuf) RawReader() io.ReadSeeker

RawReader returns a ReadSeeker for the raw zip data - useful for serving in http requests

func (*Protobuf) SHA256

func (p *Protobuf) SHA256() (string, error)

SHA256 computes the sha256zum for the protobuf zip contents

func (*Protobuf) SetDescriptor

func (p *Protobuf) SetDescriptor(raw []byte)

SetDescritptor sets the raw descriptor set from a byte slice

func (*Protobuf) SetRaw

func (p *Protobuf) SetRaw(raw []byte)

SetRaw sets the raw protobuf data from a byte slice

func (*Protobuf) SetRawFromBase64

func (p *Protobuf) SetRawFromBase64(body string) error

SetRawFromBase64 sets the raw protobuf data from a base64 string

type ProtobufDescriptors

type ProtobufDescriptors struct {
	Messages    []*ProtobufMessage `json:"messages"`
	SourceFiles []string           `json:"sourceFiles"`

	// Will add more as they are needed
	JavaPackages []*string `json:"javaPackages,omitempty"`
	GoPackages   []*string `json:"goPackages,omitempty"`
}

ProtobufDescriptors is a more human readable representation of raw file descriptors

type ProtobufMessage

type ProtobufMessage struct {
	Name   string            `json:"name"`
	Fields map[string]string `json:"fields"`
}

ProtoMessage is a more human-readable representation of raw message descriptors

Jump to

Keyboard shortcuts

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