pbmd

package
v0.0.0-...-90dec0a Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unary = iota
	ServerStreaming
	ClientStreaming
	BidirectionalStreaming
)
View Source
const ProtoTpl = `` /* 2261-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	// the package name of the proto file
	PackageName string
	// the enclosing service name
	ServiceName string
	// my name
	MethodName string
	// the url path where api gateway resolves
	URLPath string
	// the http method, which is always POST
	HTTPMethod string
	// Comment placed at the beginning, as well as inline-Comment placed at the ending
	Comment string

	Typ RPCType
	Req Request
	Res Response
}

Endpoint is also called method or interface

func (Endpoint) HRef

func (e Endpoint) HRef() string

func (Endpoint) IsWebSocket

func (e Endpoint) IsWebSocket() bool

type Enum

type Enum struct {
	// only use Comment placed at the beginning
	Comment string
	// refers by field.typ
	Name string
	// Constants
	Constants []EnumField
}

Enum is user-defined type which has one of a pre-defined list of values

func (Enum) HRef

func (e Enum) HRef() string

type EnumField

type EnumField struct {
	// Comment placed at the beginning, as well as inline-Comment placed at the ending
	Comment string
	Name    string
	Val     string
	// the Enclosing type name of this field
	Enclosing string
}

type Field

type Field struct {
	// Comment placed at the beginning, as well as inline-Comment placed at the ending
	Comment string
	Name    string
	Typ     string
	Repeat  bool
	// the Enclosing type name of this field
	Enclosing string
	// contains filtered or unexported fields
}

func (Field) Type

func (f Field) Type() (r string)

Type resolves f's type to a readable format in the scope of protoFile

func (Field) TypeHRef

func (f Field) TypeHRef() (r string)

TypeHRef is Type in addition to a href

type Object

type Object struct {
	// only use Comment placed at the beginning
	Comment string
	// refers by field.typ
	Name string
	// attributes
	Attrs []Field
}

Object is user-defined field type

func (Object) Empty

func (o Object) Empty() bool

func (Object) HRef

func (o Object) HRef() string

type ProtoFile

type ProtoFile struct {
	// a proto file could have multiple service
	Services []Service
	// a proto file should have multiple object
	Objects []Object
	// a proto file should have multiple enum
	Enums []Enum
}

ProtoFile is a parsing unit

func (*ProtoFile) ComposeFrom

func (pf *ProtoFile) ComposeFrom(pp *parser.Proto)

func (ProtoFile) GenerateMarkdown

func (pf ProtoFile) GenerateMarkdown() string

type RPCType

type RPCType int

func (RPCType) String

func (t RPCType) String() string

type Request

type Request struct {
	Params []Field
	Typ    string
}

func (Request) Empty

func (r Request) Empty() bool

type Response

type Response struct {
	Params []Field
	Typ    string
}

func (Response) Empty

func (r Response) Empty() bool

type Service

type Service struct {
	// service only use Comment placed at the beginning
	Comment string
	// the package name of the proto file
	PackageName string
	// my name
	ServiceName string
	// a service has multiple endpoint
	Infs []Endpoint
}

Service : a proto file could have multiple Service

func (Service) HRef

func (s Service) HRef() string

HRef generates a cross reference ID used in markdown

Jump to

Keyboard shortcuts

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