Browse Source

新增NewStructValuePBByBytes

dcsunny 4 năm trước cách đây
mục cha
commit
88de1aa1a8
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  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
+}