This commit is contained in:
wangchuxiao
2022-05-25 15:09:17 +08:00
parent f8bed154ce
commit 18eaae80ec
3 changed files with 32 additions and 0 deletions
+3
View File
@@ -143,7 +143,10 @@ func Pb2String(pb proto.Message) (string, error) {
EmitDefaults: false,
}
return marshaler.MarshalToString(pb)
}
func String2Pb(s string, pb proto.Message) error {
return proto.Unmarshal([]byte(s), pb)
}
func Map2Pb(m map[string]interface{}) (pb proto.Message, err error) {