pb

package
v0.0.0-...-3a47f06 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTO_SYNTAX_3       = "proto3"
	PROTO_SYNTAX_UNKNOWN = "unknown"
)

Variables

View Source
var ParsedMessages map[string]*Message
View Source
var ParsingProto map[string]bool

Functions

func GenerateIndexHTML

func GenerateIndexHTML(basePath string, services []*Service) error

func GetAbsPackage

func GetAbsPackage(pkg, imp string) string

GetAbsPackage used to get absolute package name of one proto file pkg means package name imp means import name, one import has such format:

import "common/types/types.proto"

func GetAbsPath

func GetAbsPath(pkg, imp string) string

func IsProtoParsed

func IsProtoParsed(pkg, name string) bool

func IsScalarType

func IsScalarType(name string) bool

func MakeParsed

func MakeParsed(pkg, name string, msg *Message)

func ParseOneof

func ParseOneof(lines []string, oneof *Oneof) int

func RegisterProto

func RegisterProto(pkg, name string)

Types

type Elem

type Elem struct {
	Value string
	Order int
	Note  string
}

func NewElemWithNote

func NewElemWithNote(line, note string) *Elem

type Enum

type Enum struct {
	Note  string
	Name  string
	Elems []*Elem
	// contains filtered or unexported fields
}

func (*Enum) Data

func (e *Enum) Data()

func (*Enum) Parse

func (e *Enum) Parse(lines []string) int

func (*Enum) WriteHtmlWithNavigator

func (e *Enum) WriteHtmlWithNavigator(basePath string, navigators []*Navigator) error

func (*Enum) WriteHtmlWithService

func (e *Enum) WriteHtmlWithService(basePath string, services []*Service) error

type Field

type Field struct {
	Label string
	Type  string
	Name  string
	Order int
	Note  string
	Link  string
	// contains filtered or unexported fields
}

func NewField

func NewField(pkg, line string) *Field

func NewFieldWithNote

func NewFieldWithNote(pkg, line, note string) *Field

func NewMapField

func NewMapField(pkg, line, note string) *Field

func (*Field) String

func (f *Field) String() string
func (f *Field) WithLink(path string)

type Message

type Message struct {
	Note     string
	Package  string
	Name     string
	Messages []*Message
	Enums    []*Enum
	Oneofs   []*Oneof
	Fields   []*Field
}

func (*Message) GetAll

func (m *Message) GetAll() []*Message

func (*Message) Parse

func (message *Message) Parse(lines []string, depth int) int

func (*Message) String

func (m *Message) String() string

func (*Message) WriteHtmlWithNavigator

func (m *Message) WriteHtmlWithNavigator(basePath string, navigators []*Navigator) error

func (*Message) WriteHtmlWithService

func (m *Message) WriteHtmlWithService(basePath string, services []*Service) error
type Navigator struct {
	Position string
	Name     string
}

func NewNavigator

func NewNavigator(service *Service, pkg string) *Navigator

type Oneof

type Oneof struct {
	Name   string
	Note   string
	Fields []*Field
	// contains filtered or unexported fields
}

type Proto

type Proto struct {
	Messages []*Message
	Services []*Service
	Enums    []*Enum
	Comment  string
	Package  string

	Start   int // the message start int, excludes syntax,package and imports line
	Syntax  string
	Imports []string
	Path    string // base folder of proto file
	// contains filtered or unexported fields
}

func (*Proto) Initialize

func (p *Proto) Initialize(file string) []*Proto

func (*Proto) IsSupported

func (p *Proto) IsSupported() bool

func (*Proto) JSON

func (p *Proto) JSON() (string, error)

func (*Proto) Parse

func (p *Proto) Parse()

func (*Proto) ResolveImport

func (p *Proto) ResolveImport(importFile string) []*Proto

func (*Proto) ResolveImports

func (p *Proto) ResolveImports() []*Proto

type RPC

type RPC struct {
	Note     string
	Method   string
	Request  string
	Response string

	ReqLink  string
	RespLink string
	// contains filtered or unexported fields
}

func NewRPC

func NewRPC(pkg, line string) *RPC

func NewRPCWithNote

func NewRPCWithNote(pkg, line, note string) *RPC

func (*RPC) String

func (rpc *RPC) String() string
func (rpc *RPC) WithLink(path string)

type ScalarType

type ScalarType string
const (
	DOUBLE   ScalarType = "double"
	FLOAT    ScalarType = "float"
	INT32    ScalarType = "int32"
	INT64    ScalarType = "int64"
	UINT32   ScalarType = "uint32"
	UINT64   ScalarType = "uint64"
	SINT32   ScalarType = "sint32"
	SINT64   ScalarType = "sint64"
	FIXED32  ScalarType = "fixed32"
	FIXED64  ScalarType = "fixed64"
	SFIXED32 ScalarType = "sfixed32"
	SFIXED64 ScalarType = "sfixed64"
	BOOL     ScalarType = "bool"
	STRING   ScalarType = "string"
	BYTES    ScalarType = "bytes"
	MAP      ScalarType = "map"
)

type Service

type Service struct {
	Package string
	Name    string
	RPCs    []*RPC
	Note    string
}

func (*Service) Parse

func (s *Service) Parse(lines []string, depth int) int

func (*Service) Position

func (s *Service) Position() string

func (*Service) WriteHtml

func (s *Service) WriteHtml(basePath string) error

Jump to

Keyboard shortcuts

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