converter

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoStruct2Json added in v1.1.8

func GoStruct2Json(structList []*parsing.StructFlat) (jsonStr string)

GoStruct2Json convert golang struct to json

func GoType2JsonDefaultValue added in v1.1.8

func GoType2JsonDefaultValue(goType string) (jsonDefaultValue interface{})

GoType2JsonDefaultValue convert golang type to json default value

func GoType2PB

func GoType2PB(goType string) (pbType string)

GoType2PB convert golang type to Protocol Buffers https://developers.google.com/protocol-buffers/docs/proto3 .proto Go double -> float64 float -> float32 int32 -> int32 int64 -> int64 uint32 -> uint32 uint64 -> uint64 sint32 -> int32 sint64 -> int64 fixed32 -> uint32 fixed64 -> uint64 sfixed32 -> int32 sfixed64 -> int64 bool -> bool string -> string bytes -> []byte

Types

type PBField

type PBField struct {
	Type    string
	Name    string
	Comment string
	Index   int
}

PBField pb field struct

type PBFlat

type PBFlat struct {
	Name        string
	Comment     string
	PBFieldList []*PBField
}

PBFlat pb struct

func GoStruct2PB

func GoStruct2PB(structList []*parsing.StructFlat) (pbList []*PBFlat)

GoStruct2PB convert golang struct to Protocol Buffers

Jump to

Keyboard shortcuts

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