protoc

package
v0.0.0-...-c234e47 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// COMMENT_PATH_PACKAGE package comment
	COMMENT_PATH_PACKAGE = 2
	// COMMENT_PATH_MESSAGE message comment
	COMMENT_PATH_MESSAGE = 4
	// COMMENT_PATH_ENUM enum comment
	COMMENT_PATH_ENUM = 5
	// COMMENT_PATH_SERVICE service comment
	COMMENT_PATH_SERVICE = 6
	// COMMENT_PATH_EXTENSION extension comment
	COMMENT_PATH_EXTENSION = 7
	// COMMENT_PATH_SYNTAX syntax comment
	COMMENT_PATH_SYNTAX = 12

	// COMMENT_PATH_MESSAGE_FIELD message.field
	COMMENT_PATH_MESSAGE_FIELD = 2
	// COMMENT_PATH_MESSAGE_MESSAGE message.nested
	COMMENT_PATH_MESSAGE_MESSAGE = 3
	// COMMENT_PATH_MESSAGE_ENUM message.enum
	COMMENT_PATH_MESSAGE_ENUM = 4
	// COMMENT_PATH_MESSAGE_EXTENSION message.ectension
	COMMENT_PATH_MESSAGE_EXTENSION = 6

	// COMMENT_PATH_ENUM_VALUE enum value
	COMMENT_PATH_ENUM_VALUE = 2

	// COMMENT_PATH_SERVICE_METHOD service method
	COMMENT_PATH_SERVICE_METHOD = 2
)

comment path

View Source
const (
	JSON_LABEL_OPTIONAL = "可选"
	JSON_LABEL_REQUIRED = "必须"
	JSON_LABEL_REPEATED = "重复"
)

json 字段标签

View Source
const (
	JSON_TPYE_NUMBER  = `Number`
	JSON_TYPE_STRING  = `String`
	JSON_TYPE_BOOLEAN = `Boolean`
	JSON_TYPE_OBJECT  = `Object`
)

json 字段类型

View Source
const ContentTypeJson = "application/json"

Variables

This section is empty.

Functions

func IsEntry

func IsEntry(mf *MessageField) bool

IsEntry 是否为 proto 自动创建的 entry message. 例:map<string, string>

func Plugin

func Plugin(fn func(p *Package) *pluginpb.CodeGeneratorResponse)

Plugin .

Types

type Enum

type Enum struct {
	Name        string
	Description string
	Fields      []*EnumField
}

type EnumField

type EnumField struct {
	Name        string
	Value       int32
	Description string
}

type Message

type Message struct {
	Name        string
	Description string
	Fields      []*MessageField
}

type MessageField

type MessageField struct {
	// MessageName Message.Name
	MessageName string
	// Description field description
	Description string

	ProtoName        string                                  // proto field name
	ProtoLaber       descriptorpb.FieldDescriptorProto_Label // proto 标签
	ProtoType        descriptorpb.FieldDescriptorProto_Type  // 隐式类型
	ProtoTypeName    string                                  // 显示类型
	ProtoFullName    string                                  // 包名.结构名
	ProtoPackagePath string                                  // 包路径
	ProtoNumber      int32                                   // 排序

	JsonName         string      // json field name
	JsonLabel        string      // json 标签
	JsonType         string      // json 类型
	JsonDefaultValue interface{} // json 数据默认值
}

type Method

type Method string
const (
	MethodGet    Method = "GET"
	MethodPut    Method = "PUT"
	MethodPost   Method = "POST"
	MethodDelete Method = "DELETE"
)

func (Method) LowerCase

func (m Method) LowerCase() string

LowerCase .

func (Method) String

func (m Method) String() string

String .

type Package

type Package struct {

	// Name Package.Name
	Name string
	// Version version
	Version string
	// Prefix uri prefix
	Prefix string
	// Services Service list
	Services []*Service
	// Enums Enum list
	Enums []*Enum
	// EnumDic Enum map
	EnumDic map[string]*Enum
	// Messages Message list
	Messages []*Message
	// MessageDic Message map
	MessageDic map[string]*Message
	// contains filtered or unexported fields
}

type Service

type Service struct {
	Name        string
	Description string
	// Methods rpc list
	Methods []*ServiceMethod
}

type ServiceMethod

type ServiceMethod struct {
	Name         string
	Path         string
	Method       Method
	Description  string
	Consume      string
	Produce      string
	RequestName  string
	ResponseName string
}

ServiceMethod service.rpc

Jump to

Keyboard shortcuts

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