changed param logic & add more routes
This commit is contained in:
@@ -52,3 +52,14 @@ func Encode(message string, data map[string]any) ([]byte, error) {
|
||||
|
||||
return proto.Marshal(msg)
|
||||
}
|
||||
|
||||
func ToMap(msg proto.Message) (map[string]any, error) {
|
||||
jsonBytes, err := protojson.Marshal(msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var result map[string]any
|
||||
json.Unmarshal(jsonBytes, &result)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user