parse

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package parse is parsed proto file to struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field added in v1.4.3

type Field struct {
	Name      string
	FieldType string
	Comment   string
}

Field request fields

func (Field) GoTypeZero added in v1.4.3

func (r Field) GoTypeZero() string

GoTypeZero default zero value for type

type PbService

type PbService struct {
	Name      string           // Greeter
	LowerName string           // greeter first character to lower
	ProtoName string           // proto file name greeter.proto
	Methods   []*ServiceMethod // service methods
}

PbService service fields

func GetServices

func GetServices(protoName string, file *protogen.File) []*PbService

GetServices parse protobuf services

func (*PbService) RandNumber

func (s *PbService) RandNumber() int

RandNumber rand number 1~100

type ServiceMethod

type ServiceMethod struct {
	MethodName    string   // e.g. Create
	Request       string   // e.g. CreateRequest
	RequestFields []*Field // request fields
	Reply         string   // e.g. CreateReply
	ReplyFields   []*Field
	Comment       string // e.g. Create a record

	ServiceName      string // Greeter
	LowerServiceName string // greeter first character to lower
}

ServiceMethod method fields

func (*ServiceMethod) AddOne

func (t *ServiceMethod) AddOne(i int) int

AddOne counter

Jump to

Keyboard shortcuts

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