v3

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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,
	}
)
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 Enum

type Enum struct {
	Name   string
	Fields []EnumField
}

func NewEnum

func NewEnum(enumMeta astutils.EnumMeta) Enum

func (Enum) GetName

func (e Enum) GetName() string

func (Enum) Inner

func (e Enum) Inner() bool

func (Enum) String

func (e Enum) String() string

type EnumField

type EnumField struct {
	Name   string
	Number int
}

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

func NewMessage

func NewMessage(structmeta astutils.StructMeta) Message

NewMessage returns message instance from astutils.StructMeta

func (Message) GetName

func (m Message) GetName() string

func (Message) Inner

func (m Message) Inner() bool

func (Message) String

func (m Message) String() string

type ProtobufType

type ProtobufType interface {
	GetName() string
	String() string
	Inner() bool
}

func MessageOf

func MessageOf(ft string) ProtobufType

type Rpc

type Rpc struct {
	Name       string
	Request    Message
	Response   Message
	Comments   []string
	StreamType StreamType
}

func NewRpc

func NewRpc(method astutils.MethodMeta) Rpc

type Service

type Service struct {
	Name      string
	Package   string
	GoPackage string
	Syntax    string
	// go-doudou version
	Version  string
	ProtoVer string
	Rpcs     []Rpc
	Messages []Message
	Enums    []Enum
	Comments []string
	Imports  []string
}

func NewService

func NewService(name, goPackage string) Service

type StreamType

type StreamType int

Jump to

Keyboard shortcuts

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