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