types

package
v0.0.0-...-d6a21f3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentType

type ContentType string
const (
	ContentTypeJson ContentType = "application/json"
	ContentTypeData ContentType = "multipart/form-data"
)

type DocumentType

type DocumentType string

DocumentType 文档类型

const (
	DocumentTypeHTML     DocumentType = "html"
	DocumentTypeMarkdown DocumentType = "markdown"
	DocumentTypePostman  DocumentType = "postman"
	DocumentTypeSwagger  DocumentType = "swagger"
)

type Enum

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

type EnumField

type EnumField struct {
	Name        string
	Value       int32
	Description string
}
type Header string

func (Header) Desc

func (h Header) Desc() string

Desc .

func (Header) String

func (h Header) String() string

String .

type JsonLabel

type JsonLabel string
const (
	JsonLabel_Optional JsonLabel = "可选"
	JsonLabel_Required JsonLabel = "必须"
	JsonLabel_Repeated JsonLabel = "重复"
)

func Convert2JsonLabel

Convert2JsonLabel descriptorpb.FieldDescriptorProto_Label to JsonLabel

type JsonType

type JsonType string
const (
	JsonType_Object  JsonType = "Object"
	JsonType_Number  JsonType = "Number"
	JsonType_String  JsonType = "String"
	JsonType_Boolean JsonType = "Boolean"
)

func Convert2JsonType

func Convert2JsonType(pt descriptorpb.FieldDescriptorProto_Type) JsonType

Convert2JsonType descriptorpb.FieldDescriptorProto_Type to JsonType

func (JsonType) DefaultValue

func (jt JsonType) DefaultValue() interface{}

DefaultValue .

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
	ProtoType        descriptorpb.FieldDescriptorProto_Type  // 隐式类型
	ProtoLaber       descriptorpb.FieldDescriptorProto_Label // proto 标签
	ProtoTypeName    string                                  // 显示类型
	ProtoFullName    string                                  // 包名.结构名
	ProtoPackagePath string                                  // 包路径
	ProtoNumber      int32                                   // 排序

	JsonName         string      // json field name
	JsonType         JsonType    // json 类型
	JsonLabel        JsonLabel   // 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
}

func (*Package) AppendEnum

func (p *Package) AppendEnum(def *Enum)

AppendEnum .

func (*Package) AppendMessage

func (p *Package) AppendMessage(def *Message)

AppendMessage .

func (*Package) Sort

func (p *Package) Sort() *Package

Sort .

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      ContentType
	Produce      ContentType
	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