Documentation ¶
Index ¶
- func IsSameType(t1, t2 Type) bool
- func NewDecorateWriter(w io.Writer, prefix, postfix string) io.Writer
- func NewSpaceWriter(w io.Writer, count int) io.Writer
- func NewTabWriter(w io.Writer) io.Writer
- type BuiltinType
- type Comment
- type Enum
- type EnumField
- type EnumValueOption
- type FieldOption
- type File
- type Import
- type Message
- type MessageField
- type Node
- type OneOf
- type OneOfField
- type Option
- type Package
- type RPC
- type ReturnType
- type Service
- type Syntax
- type Type
- type TypeAdder
- type Visibility
- type WellKnownType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSameType ¶
Types ¶
type BuiltinType ¶
type BuiltinType string
const ( Double BuiltinType = "double" Float BuiltinType = "float" Int32 BuiltinType = "int32" Int64 BuiltinType = "int64" UInt32 BuiltinType = "uint32" UInt64 BuiltinType = "uint64" SInt32 BuiltinType = "sint32" SInt64 BuiltinType = "sint64" Fixed32 BuiltinType = "fixed32" Fixed64 BuiltinType = "fixed64" SFixed32 BuiltinType = "sfixed32" SFixed64 BuiltinType = "sfixed64" Bool BuiltinType = "bool" String BuiltinType = "string" Bytes BuiltinType = "bytes" )
func (BuiltinType) TypeName ¶
func (t BuiltinType) TypeName() string
type Enum ¶
type EnumField ¶
type EnumField struct { Name string `json:"name"` Index int `json:"index"` Comment []string `json:"comment"` Options []*EnumValueOption `json:"option"` }
func NewEnumField ¶
func (*EnumField) AddOption ¶
func (f *EnumField) AddOption(o *EnumValueOption) *EnumField
type EnumValueOption ¶
func NewEnumValueOption ¶
func NewEnumValueOption(name, value string) *EnumValueOption
type FieldOption ¶
func NewFieldOption ¶
func NewFieldOption(name, value string) *FieldOption
type File ¶
type File struct { Syntax Syntax `json:"-"` Package Package `json:"package"` Comment Comment `json:"comment"` Imports []*Import `json:"imports"` Options []*Option `json:"options"` Messages []*Message `json:"messages"` Enums []*Enum `json:"enums"` Services []*Service `json:"services"` }
func (*File) AddMessage ¶
func (*File) AddService ¶
type Import ¶
type Import struct { Name string Visibility Visibility }
func NewPublicImport ¶
func NewWeakImport ¶
type Message ¶
type Message struct { Name string `json:"name"` Comment Comment `json:"comment"` Fields []*MessageField `json:"fields"` Enums []*Enum `json:"enums"` Messages []*Message `json:"messages"` OneOfs []*OneOf `json:"oneOfs"` }
func NewMessage ¶
func (*Message) AddField ¶
func (m *Message) AddField(f *MessageField) *Message
func (*Message) AddMessage ¶
type MessageField ¶
type MessageField struct { Repeated bool `json:"repeated"` Type string `json:"type"` Name string `json:"name"` Index int `json:"index"` Options []*FieldOption `json:"options"` Comment Comment `json:"comment"` }
func NewMessageField ¶
func NewMessageField(t Type, name string, index int) *MessageField
func NewRepeatedMessageField ¶
func NewRepeatedMessageField(t Type, name string, index int) *MessageField
func (*MessageField) AddOption ¶
func (f *MessageField) AddOption(o *FieldOption) *MessageField
type Node ¶
type Node interface {
// contains filtered or unexported methods
}
Node represents a node in an abstract syntax tree
type OneOf ¶
type OneOf struct { Name string `json:"name"` Comment Comment `json:"comment"` Fields []*OneOfField `json:"fields"` }
func (*OneOf) AddField ¶
func (o *OneOf) AddField(f *OneOfField) *OneOf
type OneOfField ¶
type OneOfField struct { Type string `json:"type"` Name string `json:"name"` Index int `json:"index"` Comment Comment `json:"comment"` Options []*Option `json:"options"` }
func NewOneOfField ¶
func NewOneOfField(t Type, name string, index int) *OneOfField
func (*OneOfField) AddOption ¶
func (f *OneOfField) AddOption(o *Option) *OneOfField
type Option ¶
type RPC ¶
type RPC struct { Name string Comment Comment Input *ReturnType Output *ReturnType Options []*Option }
func NewRPC ¶
func NewRPC(name string, input *ReturnType, output *ReturnType) *RPC
type ReturnType ¶
func NewReturnType ¶
func NewReturnType(name string) *ReturnType
func (*ReturnType) SetStreamable ¶
func (r *ReturnType) SetStreamable(s bool) *ReturnType
type Visibility ¶
type Visibility int
const ( NotSpecified Visibility = iota Weak Public )
func (Visibility) String ¶
func (v Visibility) String() string
type WellKnownType ¶
type WellKnownType string
const ( Any WellKnownType = "google.protobuf.Any" Api WellKnownType = "google.protobuf.Api" BoolValue WellKnownType = "google.protobuf.BoolValue" BytesValue WellKnownType = "google.protobuf.BytesValue" DoubleValue WellKnownType = "google.protobuf.DoubleValue" Duration WellKnownType = "google.protobuf.Duration" Empty WellKnownType = "google.protobuf.Empty" WellKnownEnum WellKnownType = "google.protobuf.Enum" EnumValue WellKnownType = "google.protobuf.EnumValue" WellKnownField WellKnownType = "google.protobuf.Field" Cardinality WellKnownType = "google.protobuf.Cardinality" Kind WellKnownType = "google.protobuf.Kind" FieldMask WellKnownType = "google.protobuf.FieldMask" FloatValue WellKnownType = "google.protobuf.FloatValue" Int32Value WellKnownType = "google.protobuf.Int32Value" Int64Value WellKnownType = "google.protobuf.Int64Value" ListValue WellKnownType = "google.protobuf.ListValue" Method WellKnownType = "google.protobuf.Method" Mixin WellKnownType = "google.protobuf.Mixin" NullValue WellKnownType = "google.protobuf.NullValue" WellKnownOption WellKnownType = "google.protobuf.Option" SourceContext WellKnownType = "google.protobuf.SourceContext" StringValue WellKnownType = "google.protobuf.StringValue" WellKnownStruct WellKnownType = "google.protobuf.Struct" WellKnownSyntax WellKnownType = "google.protobuf.Syntax" Timestamp WellKnownType = "google.protobuf.Timestamp" UInt32Value WellKnownType = "google.protobuf.UInt32Value" UInt64Value WellKnownType = "google.protobuf.UInt64Value" Value WellKnownType = "google.protobuf.Value" )
func (WellKnownType) TypeName ¶
func (t WellKnownType) TypeName() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.