Parcourir la source

新增NewStructValuePBByBytes

dcsunny il y a 4 ans
Parent
commit
88de1aa1a8
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  1. 6 0
      common/json.go

+ 6 - 0
common/json.go

@@ -16,3 +16,9 @@ func NewStructValuePB(v interface{}) *structpb.Value {
 	s.UnmarshalJSON(MarshalJSON(v))
 	return s
 }
+
+func NewStructValuePBByBytes(v []byte) *structpb.Value {
+	s := new(structpb.Value)
+	s.UnmarshalJSON(v)
+	return s
+}