Documentation ¶
Index ¶
- func Bytes2Object(obj proto.Message, data []byte, intype EncodingType) error
- func JSON2Yaml(buf []byte) ([]byte, error)
- func Load(filename string, obj proto.Message) error
- func Objet2Bytes(obj proto.Message, outtype EncodingType) ([]byte, error)
- func Yaml2JSON(buf []byte) ([]byte, error)
- type EncodingType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes2Object ¶
func Bytes2Object(obj proto.Message, data []byte, intype EncodingType) error
Bytes2Object Convert object which has proto, json, yaml interface to data
func Load ¶
Load : this function load a file and unmarshall file into obj. File can have different formats depending on its extension .json -> json file .yaml, .yml -> yaml file any -> binary protobuf encoded
func Objet2Bytes ¶
func Objet2Bytes(obj proto.Message, outtype EncodingType) ([]byte, error)
Objet2Bytes marshal an object from type proto.Message to byte array depending on EncodingType code
Types ¶
type EncodingType ¶
type EncodingType int
EncodingType format code
const ( // EncodingTypeJSON : JSON format EncodingTypeJSON EncodingType = iota // EncodingTypeYaml : Yaml format EncodingTypeYaml // EncodingTypeBinaryPB : Protocol buffer binary encoded format EncodingTypeBinaryPB )
func EncodingTypeFromString ¶
func EncodingTypeFromString(str string) EncodingType
EncodingTypeFromString Convert string JSON, Yaml, or any to EncodingType Code
Click to show internal directories.
Click to hide internal directories.