ann

package
v0.1.1-no-docker5 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2016 License: BSD-3-Clause, MIT Imports: 8 Imported by: 19

Documentation

Overview

Package ann is a generated protocol buffer package.

It is generated from these files:

ann.proto

It has these top-level messages:

Ann

Package ann defines types that represent source code annotations.

Index

Constants

View Source
const (
	// Link is a type of annotation that refers to an arbitrary URL
	// (typically pointing to an external web page).
	Link = "link"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ann

type Ann struct {
	// Repo is the VCS repository in which this ann exists.
	Repo string `protobuf:"bytes,1,opt,name=repo,proto3" json:"Repo,omitempty"`
	// CommitID is the ID of the VCS commit that this ann exists
	// in. The CommitID is always a full commit ID (40 hexadecimal
	// characters for git and hg), never a branch or tag name.
	CommitID string `protobuf:"bytes,2,opt,name=commit_id,proto3" json:"CommitID,omitempty"`
	// UnitType is the source unit type that the annotation exists
	// on. It is either the source unit type during whose processing
	// the annotation was detected/created. Multiple annotations may
	// exist on the same file from different source unit types if a
	// file is contained in multiple source units.
	UnitType string `protobuf:"bytes,3,opt,name=unit_type,proto3" json:"UnitType,omitempty"`
	// Unit is the name of the source unit that this ann exists in.
	Unit string `protobuf:"bytes,4,opt,name=unit,proto3" json:"Unit,omitempty"`
	// File is the filename in which this Ann exists.
	File string `protobuf:"bytes,5,opt,name=file,proto3" json:"File,omitempty"`
	// StartLine is the line number (inclusive, 1-indexed) of the
	// beginning of the annotation.
	StartLine uint32 `protobuf:"varint,6,opt,name=start_line,proto3" json:"StartLine"`
	// EndLine is the line number (inclusive, 1-indexed) of the end of
	// the annotation.
	EndLine uint32 `protobuf:"varint,7,opt,name=end_line,proto3" json:"EndLine"`
	// Type is the type of the annotation. See this package's type
	// constants for a list of possible types.
	Type string `protobuf:"bytes,8,opt,name=type,proto3" json:"Type"`
	// Data contains arbitrary JSON data that is specific to this
	// annotation type (e.g., the link URL for Link annotations).
	Data sourcegraph_com_sqs_pbtypes.RawMessage `protobuf:"bytes,9,opt,name=data,proto3,customtype=sourcegraph.com/sqs/pbtypes.RawMessage" json:"Data,omitempty"`
}

An Ann is a source code annotation.

Annotations are unique on (Repo, CommitID, UnitType, Unit, File, StartLine, EndLine, Type).

func (*Ann) LinkURL

func (a *Ann) LinkURL() (*url.URL, error)

LinkURL parses and returns a's link URL, if a's type is Link and if its Data contains a valid URL (encoded as a JSON string).

func (*Ann) ProtoMessage added in v0.0.33

func (*Ann) ProtoMessage()

func (*Ann) Reset added in v0.0.33

func (m *Ann) Reset()

func (*Ann) SetLinkURL

func (a *Ann) SetLinkURL(urlStr string) error

SetLinkURL sets a's Type to Link and Data to the JSON representation of the URL string. If the URL is invalid, an error is returned.

func (*Ann) String added in v0.0.33

func (m *Ann) String() string

type Anns

type Anns []*Ann

func (Anns) Len

func (vs Anns) Len() int

func (Anns) Less

func (vs Anns) Less(i, j int) bool

func (Anns) Swap

func (vs Anns) Swap(i, j int)

type ErrType

type ErrType struct {
	Expected, Actual string // Expected and actual types
	Op               string // The name of the operation or method that was called
}

ErrType indicates that an operation performed on an annotation expected the annotation to be a different type (e.g., calling LinkURL on a non-link annotation).

func (*ErrType) Error

func (e *ErrType) Error() string

Jump to

Keyboard shortcuts

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