gengolang

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenGolang

func GenGolang(schemas *mtproto_parser.MTProtoSchemas, outFilePath string)

func IsLetter

func IsLetter(b byte) bool

IsLetter check character is a letter or not

func IsLower

func IsLower(b byte) bool

IsLower check letter is lower case or not

func IsSpace

func IsSpace(b byte) bool

IsSpace only call unicode.IsSpace

func IsSpaceQuote

func IsSpaceQuote(b byte) bool

IsSpaceQuote return wehter a byte is space or quote characters

func IsUpper

func IsUpper(b byte) bool

IsUpper check letter is upper case or not

func ToAbridge

func ToAbridge(str string) string

ToAbridge extract first letter and all upper case letter from string as it's abridge case

func ToCamel

func ToCamel(s string) string

ToCamel string, xx_yy to XxYy, xx__yy to Xx_Yy xx _yy to Xx Yy, the rule is that a lower case letter after '_' will combine to a upper case letter

func ToLower

func ToLower(b byte) byte

ToLower convert a byte to lower case

func ToLowerAbridge

func ToLowerAbridge(str string) (s string)

ToLowerAbridge extract first letter and all upper case letter from string as it's abridge case, and convert it to lower case

func ToLowerString

func ToLowerString(b byte) string

ToLowerString convert a byte to lower case string

func ToSnake

func ToSnake(s string) string

ToSnake string, XxYy to xx_yy, X_Y to x_y

func ToUpper

func ToUpper(b byte) byte

ToUpper convert a byte to upper case

func ToUpperString

func ToUpperString(b byte) string

ToUpperString convert a byte to upper case string

Types

type TplBaseTypeData

type TplBaseTypeData struct {
	Name      string
	ParamList []TplParam
	// Line string
	ResType string
	// 所有的子类
	SubMessageList []TplMessageData
}

Base类型

type TplCRC32

type TplCRC32 struct {
	CRC32List []TplCRC32Info
}

type TplCRC32Info

type TplCRC32Info struct {
	Name string
	Type string
}

type TplCodecDataList

type TplCodecDataList struct {
	BaseTypeList []TplBaseTypeData
	RequestList  []TplMessageData
	CRC32List    []TplCRC32Info
}

types

type TplFunctionDataList

type TplFunctionDataList struct {
	RequestList []TplMessageData
	// Vector是非标准proto消息,故要自动生成一个Vector包装proto消息
	// 注意去重
	VectorResList []TplParam
	// RpcList
	// service RPCAuth {
	//	rpc auth_checkPhone(TL_auth_checkPhone) returns (auth_CheckedPhone) {}
	// }
	ServiceList []TplBaseTypeData
}

functions

type TplMessageData

type TplMessageData struct {
	Predicate string
	Name      string
	// 碰撞的字段名,特殊处理
	ParamList []TplParam
	ResType   string
	Line      string

	EncodeCodeList []string
	DecodeCodeList []string
}

对应生成proto消息

type TplParam

type TplParam struct {
	Type  string
	Name  string
	Name2 string
	Index int
}

参数列表

type TplServiceData

type TplServiceData struct {
	RPCName      string
	MethodName   string
	RequestName  string
	ResponseName string
	Line         string
}

type TplServiceDataList

type TplServiceDataList struct {
	ServiceList map[string][]TplServiceData
}

functions

Jump to

Keyboard shortcuts

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