Version: v0.0.0-...-5182803 Latest Latest

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

Go to latest
Published: Mar 5, 2018 License: Apache-2.0 Imports: 2 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type DefinitionComments

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.


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

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

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

func (m *MessageDefinition) ProtoName() string

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

type Registry

type Registry struct {
	// contains filtered or unexported fields

func New

func (*Registry) FileComments

func (*Registry) MessageDefinition

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

func (*Registry) MethodInputDefinition

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

func (*Registry) MethodOutputDefinition

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

Source Files

Jump to

Keyboard shortcuts

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