twirp: github.com/twitchtv/twirp/internal/gen Index | Files | Directories

package gen

import "github.com/twitchtv/twirp/internal/gen"

Index

Package Files

logging.go main.go version.go wrappers.go

Constants

const Version = "v7.1.0"

func Error Uses

func Error(err error, msgs ...string)

func Fail Uses

func Fail(msgs ...string)

func FilesToGenerate Uses

func FilesToGenerate(req *plugin.CodeGeneratorRequest) []*descriptor.FileDescriptorProto

func Main Uses

func Main(g Generator)

type Descriptor Uses

type Descriptor struct {
    *descriptor.DescriptorProto
    Parent *Descriptor // The containing message, if any.
    // contains filtered or unexported fields
}

Descriptor represents a protocol buffer message.

func (*Descriptor) File Uses

func (c *Descriptor) File() *descriptor.FileDescriptorProto

func (*Descriptor) TypeName Uses

func (d *Descriptor) TypeName() []string

TypeName returns the elements of the dotted type name. The package name is not part of this name.

type EnumDescriptor Uses

type EnumDescriptor struct {
    *descriptor.EnumDescriptorProto
    // contains filtered or unexported fields
}

EnumDescriptor describes an enum. If it's at top level, its parent will be nil. Otherwise it will be the descriptor of the message in which it is defined.

func (*EnumDescriptor) File Uses

func (c *EnumDescriptor) File() *descriptor.FileDescriptorProto

func (*EnumDescriptor) TypeName Uses

func (e *EnumDescriptor) TypeName() (s []string)

TypeName returns the elements of the dotted type name. The package name is not part of this name.

type ExtensionDescriptor Uses

type ExtensionDescriptor struct {
    *descriptor.FieldDescriptorProto
    // contains filtered or unexported fields
}

ExtensionDescriptor describes an extension. If it's at top level, its parent will be nil. Otherwise it will be the descriptor of the message in which it is defined.

func (*ExtensionDescriptor) DescName Uses

func (e *ExtensionDescriptor) DescName() string

DescName returns the variable name used for the generated descriptor.

func (*ExtensionDescriptor) File Uses

func (c *ExtensionDescriptor) File() *descriptor.FileDescriptorProto

func (*ExtensionDescriptor) TypeName Uses

func (e *ExtensionDescriptor) TypeName() (s []string)

TypeName returns the elements of the dotted type name. The package name is not part of this name.

type FileDescriptor Uses

type FileDescriptor struct {
    *descriptor.FileDescriptorProto
    Descriptors []*Descriptor          // All the messages defined in this file.
    Enums       []*EnumDescriptor      // All the enums defined in this file.
    Extensions  []*ExtensionDescriptor // All the top-level extensions defined in this file.
    Imported    []*ImportedDescriptor  // All types defined in files publicly imported by this file.
    Services    []*ServiceDescriptor   // All the services defined in this file.

    // Comments, stored as a map of path (comma-separated integers) to the comment.
    Comments map[string]*descriptor.SourceCodeInfo_Location

    Index int // The index of this file in the list of files to generate code for
    // contains filtered or unexported fields
}

FileDescriptor describes an protocol buffer descriptor file (.proto). It includes slices of all the messages and enums defined within it. Those slices are constructed by WrapTypes.

func WrapTypes Uses

func WrapTypes(req *plugin.CodeGeneratorRequest) (genFiles, allFiles []*FileDescriptor, allFilesByName map[string]*FileDescriptor)

WrapTypes walks the incoming data, wrapping DescriptorProtos, EnumDescriptorProtos and FileDescriptorProtos into file-referenced objects within the Generator. It also creates the list of files to generate and so should be called before GenerateAllFiles.

func (*FileDescriptor) BaseFileName Uses

func (d *FileDescriptor) BaseFileName() string

func (*FileDescriptor) PackageComments Uses

func (d *FileDescriptor) PackageComments() string

func (*FileDescriptor) VarName Uses

func (d *FileDescriptor) VarName() string

VarName is the variable name used in generated code to refer to the compressed bytes of this descriptor. It is not exported, so it is only valid inside the generated package.

protoc-gen-go writes its own version of this file, but so does protoc-gen-gogo - with a different name! Twirp aims to be compatible with both; the simplest way forward is to write the file descriptor again as another variable that we control.

type Generator Uses

type Generator interface {
    Generate(in *plugin.CodeGeneratorRequest) *plugin.CodeGeneratorResponse
}

type ImportedDescriptor Uses

type ImportedDescriptor struct {
    Object Object
    // contains filtered or unexported fields
}

ImportedDescriptor describes a type that has been publicly imported from another file.

func (*ImportedDescriptor) File Uses

func (c *ImportedDescriptor) File() *descriptor.FileDescriptorProto

func (*ImportedDescriptor) TypeName Uses

func (id *ImportedDescriptor) TypeName() []string

type MethodDescriptor Uses

type MethodDescriptor struct {
    *descriptor.MethodDescriptorProto

    Path string // The SourceCodeInfo path as comma-separated integers.
    // contains filtered or unexported fields
}

MethodDescriptor represents an RPC method on a protocol buffer service.

func (*MethodDescriptor) File Uses

func (c *MethodDescriptor) File() *descriptor.FileDescriptorProto

func (*MethodDescriptor) TypeName Uses

func (md *MethodDescriptor) TypeName() []string

type Object Uses

type Object interface {
    TypeName() []string
    File() *descriptor.FileDescriptorProto
}

Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects.

type ServiceDescriptor Uses

type ServiceDescriptor struct {
    *descriptor.ServiceDescriptorProto
    Methods []*MethodDescriptor
    Index   int // index of the ServiceDescriptorProto in its parent FileDescriptorProto

    Path string // The SourceCodeInfo path as comma-separated integers.
    // contains filtered or unexported fields
}

ServiceDescriptor represents a protocol buffer service.

func (*ServiceDescriptor) File Uses

func (c *ServiceDescriptor) File() *descriptor.FileDescriptorProto

func (*ServiceDescriptor) TypeName Uses

func (sd *ServiceDescriptor) TypeName() []string

Directories

PathSynopsis
stringutils
typemap

Package gen imports 12 packages (graph) and is imported by 7 packages. Updated 2020-10-01. Refresh now. Tools for package owners.