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

package typemap

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

Index

Package Files

typemap.go

type DefinitionComments Uses

type DefinitionComments struct {
    Leading         string
    Trailing        string
    LeadingDetached []string
}

DefinitionComments contains the comments surrounding a definition in a protobuf file.

These follow the rules described by protobuf:

A series of line comments appearing on consecutive lines, with no other tokens appearing on those lines, will be treated as a single comment.

leading_detached_comments will keep paragraphs of comments that appear before (but not connected to) the current element. Each paragraph, separated by empty lines, will be one comment element in the repeated field.

Only the comment content is provided; comment markers (e.g. //) are stripped out. For block comments, leading whitespace and an asterisk will be stripped from the beginning of each line other than the first. Newlines are included in the output.

Examples:

optional int32 foo = 1;  // Comment attached to foo.
// Comment attached to bar.
optional int32 bar = 2;

optional string baz = 3;
// Comment attached to baz.
// Another line attached to baz.

// Comment attached to qux.
//
// Another line attached to qux.
optional double qux = 4;

// Detached comment for corge. This is not leading or trailing comments
// to qux or corge because there are blank lines separating it from
// both.

// Detached comment for corge paragraph 2.

optional string corge = 5;
/* Block comment attached
 * to corge.  Leading asterisks
 * will be removed. */
/* Block comment attached to
 * grault. */
optional int32 grault = 6;

// ignored detached comments.

type MessageDefinition Uses

type MessageDefinition struct {
    // Descriptor is is the DescriptorProto defining the message.
    Descriptor *descriptor.DescriptorProto
    // File is the File that the message was defined in. Or, if it has been
    // publicly imported, what File was that import performed in?
    File *descriptor.FileDescriptorProto
    // Parent is the parent message, if this was defined as a nested message. If
    // this was defiend at the top level, parent is nil.
    Parent *MessageDefinition
    // Comments describes the comments surrounding a message's definition. If it
    // was publicly imported, then these comments are from the actual source file,
    // not the file that the import was performed in.
    Comments DefinitionComments
    // contains filtered or unexported fields
}

func (*MessageDefinition) Lineage Uses

func (m *MessageDefinition) Lineage() []*MessageDefinition

Lineage returns m's parental chain all the way back up to a top-level message definition. The first element of the returned slice is the highest-level parent.

func (*MessageDefinition) ProtoName Uses

func (m *MessageDefinition) ProtoName() string

ProtoName returns the dot-delimited, fully-qualified protobuf name of the message.

type Registry Uses

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

func New Uses

func New(files []*descriptor.FileDescriptorProto) *Registry

func (*Registry) FileComments Uses

func (r *Registry) FileComments(file *descriptor.FileDescriptorProto) (DefinitionComments, error)

func (*Registry) MessageDefinition Uses

func (r *Registry) MessageDefinition(name string) *MessageDefinition

func (*Registry) MethodComments Uses

func (r *Registry) MethodComments(file *descriptor.FileDescriptorProto, svc *descriptor.ServiceDescriptorProto, method *descriptor.MethodDescriptorProto) (DefinitionComments, error)

func (*Registry) MethodInputDefinition Uses

func (r *Registry) MethodInputDefinition(method *descriptor.MethodDescriptorProto) *MessageDefinition

func (*Registry) MethodOutputDefinition Uses

func (r *Registry) MethodOutputDefinition(method *descriptor.MethodDescriptorProto) *MessageDefinition

func (*Registry) ServiceComments Uses

func (r *Registry) ServiceComments(file *descriptor.FileDescriptorProto, svc *descriptor.ServiceDescriptorProto) (DefinitionComments, error)

Package typemap imports 2 packages (graph) and is imported by 7 packages. Updated 2018-04-06. Refresh now. Tools for package owners.