Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoGoPathSet = errors.New("GOPATH environment variable is not set")
ErrNoGoPathSet is the error returned when the GOPATH variable is not set.
Functions ¶
This section is empty.
Types ¶
type Alias ¶
type Alias struct { *BaseType // Type represents the type being declared Type Type // Underlying represent the aliased type. Underlying Type }
Alias represents a type declaration from a type to another type
func (Alias) IsNullable ¶
func (Alias) IsRepeated ¶
func (Alias) TypeString ¶
TypeString returns a string representation for the type casting
func (Alias) UnqualifiedName ¶
UnqualifiedName returns the bare name, without the package.
type BaseType ¶
BaseType contains the common fields for all the types.
func (*BaseType) IsNullable ¶
IsNullable reports wether the type is a pointer or not.
func (*BaseType) IsRepeated ¶
IsRepeated reports wether the type is repeated or not.
func (*BaseType) SetNullable ¶
SetNullable sets the type as pointer.
func (*BaseType) SetRepeated ¶
SetRepeated sets the type as repeated or not repeated.
func (*BaseType) TypeString ¶
TypeString returns a string representation for the type casting
func (*BaseType) UnqualifiedName ¶
String returns a string representation for the type
type Basic ¶
Basic is a basic type, which only is identified by its name.
func (Basic) IsNullable ¶
IsNullable returns true. Basic types though cannot be nullable, they are considered so in protobuf.
func (Basic) TypeString ¶
TypeString returns a string representation for the type casting
func (Basic) UnqualifiedName ¶
UnqualifiedName returns the bare name, without the package.
type Docs ¶
type Docs struct {
Doc []string
}
Docs holds the documentation of a struct, enum, value, field, etc.
func (*Docs) SetDocs ¶
func (d *Docs) SetDocs(comments *ast.CommentGroup)
SetDocs sets the documentation from an AST comment group. It removes the //proteus:generate comment from the comments.
type Documentable ¶
type Documentable interface { // SetDocs sets the documentation from an AST comment group. SetDocs(*ast.CommentGroup) }
Documentable is something whose documentation can be set.
type Func ¶
type Func struct { Docs Name string // Receiver will not be nil if it's a method. Receiver Type Input []Type Output []Type // IsVariadic will be true if the last input parameter is variadic. IsVariadic bool }
Func is either a function or a method. Receiver will be nil in functions, otherwise it is a method.
type Map ¶
Map is a map type with a key and a value type.
func (Map) TypeString ¶
TypeString returns a string representation for the type casting
func (Map) UnqualifiedName ¶
UnqualifiedName returns the bare name, without the package.
type Named ¶
Named is non-basic type identified by a name on some package.
func (Named) TypeString ¶
TypeString returns a string representation for the type casting
func (Named) UnqualifiedName ¶
UnqualifiedName returns the bare name, without the package.
type Package ¶
type Package struct { Resolved bool Path string Name string Structs []*Struct Enums []*Enum Funcs []*Func Aliases map[string]Type }
Package holds information about a single Go package and a reference of all defined structs and type aliases. A Package is only safe to use once it is resolved.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner scans packages looking for Go source files to parse and extract types and structs from.
type Type ¶
type Type interface { fmt.Stringer SetRepeated(bool) IsRepeated() bool SetNullable(bool) IsNullable() bool // TypeString returns a string representing the final type. // Though this might seem that this should be just String, for Alias types // both representations are different: a string representation of the final // type, this is just the alias, while string contains also the underlying type. TypeString() string // Name returns the unqualified name. UnqualifiedName() string }
Type is the common interface for all possible types supported in protogo. Type is neither a representation of a Go type nor a representation of a protobuf type. Is an intermediate representation to ease future steps in the conversion from Go to protobuf. All types can be repeated (or not).