Documentation ¶
Index ¶
- Constants
- Variables
- type Enum
- type EnumField
- type Field
- type Message
- type ProtoGenerator
- func (receiver ProtoGenerator) MessageOf(ft string) ProtobufType
- func (receiver ProtoGenerator) NewEnum(enumMeta astutils.EnumMeta) Enum
- func (receiver ProtoGenerator) NewMessage(structmeta astutils.StructMeta) Message
- func (receiver ProtoGenerator) NewRpc(method astutils.MethodMeta) Rpc
- func (receiver ProtoGenerator) NewService(name, goPackage string) Service
- type ProtoGeneratorOption
- type ProtobufType
- type Rpc
- type Service
- type StreamType
Constants ¶
View Source
const Syntax = "proto3"
Variables ¶
View Source
var ( Double = Message{ Name: "double", IsScalar: true, } Float = Message{ Name: "float", IsScalar: true, } Int32 = Message{ Name: "int32", IsScalar: true, } Int64 = Message{ Name: "int64", IsScalar: true, } Uint32 = Message{ Name: "uint32", IsScalar: true, } Uint64 = Message{ Name: "uint64", IsScalar: true, } Bool = Message{ Name: "bool", IsScalar: true, } String = Message{ Name: "string", IsScalar: true, } Bytes = Message{ Name: "bytes", IsScalar: true, } Any = Message{ Name: "google.protobuf.Any", IsTopLevel: true, IsImported: true, } Empty = Message{ Name: "google.protobuf.Empty", IsTopLevel: true, IsImported: true, } Time = Message{ Name: "google.protobuf.Timestamp", IsScalar: true, } )
View Source
var EnumStore = make(map[string]Enum)
View Source
var ImportStore = make(map[string]struct{})
View Source
var MessageNames []string
View Source
var MessageStore = make(map[string]Message)
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct { Name string Type ProtobufType Number int Comments []string JsonName string }
Field represents protobuf message field definition
type Message ¶
type Message struct { Name string Fields []Field Comments []string IsInner bool IsScalar bool IsMap bool IsRepeated bool IsTopLevel bool // IsImported denotes the message will be imported from third-party, such as from google/protobuf IsImported bool }
Message represents protobuf message definition
type ProtoGenerator ¶
type ProtoGenerator struct { Structs []astutils.StructMeta // contains filtered or unexported fields }
func NewProtoGenerator ¶
func NewProtoGenerator(options ...ProtoGeneratorOption) ProtoGenerator
func (ProtoGenerator) MessageOf ¶
func (receiver ProtoGenerator) MessageOf(ft string) ProtobufType
func (ProtoGenerator) NewEnum ¶
func (receiver ProtoGenerator) NewEnum(enumMeta astutils.EnumMeta) Enum
func (ProtoGenerator) NewMessage ¶
func (receiver ProtoGenerator) NewMessage(structmeta astutils.StructMeta) Message
NewMessage returns message instance from astutils.StructMeta
func (ProtoGenerator) NewRpc ¶
func (receiver ProtoGenerator) NewRpc(method astutils.MethodMeta) Rpc
func (ProtoGenerator) NewService ¶
func (receiver ProtoGenerator) NewService(name, goPackage string) Service
type ProtoGeneratorOption ¶
type ProtoGeneratorOption func(*ProtoGenerator)
func WithFieldNamingFunc ¶
func WithFieldNamingFunc(fn func(string) string) ProtoGeneratorOption
type ProtobufType ¶
type Rpc ¶
type Rpc struct { Name string Request Message Response Message Comments []string StreamType StreamType }
type StreamType ¶
type StreamType int
Click to show internal directories.
Click to hide internal directories.