|
@@ -1,8 +1,18 @@
|
|
|
package common
|
|
package common
|
|
|
|
|
|
|
|
-import "encoding/json"
|
|
|
|
|
|
|
+import (
|
|
|
|
|
+ "encoding/json"
|
|
|
|
|
+
|
|
|
|
|
+ "google.golang.org/protobuf/types/known/structpb"
|
|
|
|
|
+)
|
|
|
|
|
|
|
|
func MarshalJSON(v interface{}) []byte {
|
|
func MarshalJSON(v interface{}) []byte {
|
|
|
j, _ := json.Marshal(v)
|
|
j, _ := json.Marshal(v)
|
|
|
return j
|
|
return j
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+func NewStructValuePB(v interface{}) *structpb.Value {
|
|
|
|
|
+ s := new(structpb.Value)
|
|
|
|
|
+ s.UnmarshalJSON(MarshalJSON(v))
|
|
|
|
|
+ return s
|
|
|
|
|
+}
|