mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-30 10:19:22 +08:00
fix Pb2String
This commit is contained in:
parent
924aa8ecb5
commit
5ae35bfee1
@ -137,12 +137,17 @@ func RemoveRepeatedStringInList(slc []string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Pb2String(pb proto.Message) (string, error) {
|
func Pb2String(pb proto.Message) (string, error) {
|
||||||
marshaler := jsonpb.Marshaler{
|
//marshaler := jsonpb.Marshaler{
|
||||||
OrigName: true,
|
// OrigName: true,
|
||||||
EnumsAsInts: false,
|
// EnumsAsInts: false,
|
||||||
EmitDefaults: false,
|
// EmitDefaults: false,
|
||||||
|
//}
|
||||||
|
//return marshaler.MarshalToString(pb)
|
||||||
|
bytes, err := proto.Marshal(pb)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
}
|
}
|
||||||
return marshaler.MarshalToString(pb)
|
return string(bytes), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func String2Pb(s string, pb proto.Message) error {
|
func String2Pb(s string, pb proto.Message) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user