mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
single marshaller
This commit is contained in:
parent
8ced7fb04c
commit
c564f47b92
@ -10,6 +10,10 @@ import (
|
|||||||
"github.com/caos/logging"
|
"github.com/caos/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
marshaller = new(jsonpb.Marshaler)
|
||||||
|
)
|
||||||
|
|
||||||
func MustToPBStruct(object interface{}) *pb_struct.Struct {
|
func MustToPBStruct(object interface{}) *pb_struct.Struct {
|
||||||
s, err := ToPBStruct(object)
|
s, err := ToPBStruct(object)
|
||||||
logging.Log("PROTO-7Aa3t").OnError(err).Panic("unable to map object to pb-struct")
|
logging.Log("PROTO-7Aa3t").OnError(err).Panic("unable to map object to pb-struct")
|
||||||
@ -38,7 +42,6 @@ func MustFromPBStruct(object interface{}, s *pb_struct.Struct) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FromPBStruct(object interface{}, s *pb_struct.Struct) error {
|
func FromPBStruct(object interface{}, s *pb_struct.Struct) error {
|
||||||
marshaller := new(jsonpb.Marshaler)
|
|
||||||
jsonString, err := marshaller.MarshalToString(s)
|
jsonString, err := marshaller.MarshalToString(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user