Files
houston-be/common/util/structUtil/struct_util.go
Gullipalli Chetan Kumar a4c648649b TP-54496 | Created justification message prompt for de-escalation (#360)
* TP-54496| created justification message prompt for de-escalation

* TP-54496| added migration file to update new column in log table

* TP-54496| added feature flag

* TP-54496| created util functions and constants

* TP-54496| updated design changes

* TP-54496| made the requested changed in PR comments

* TP-54496| fixed bugs in merge conflicts

* TP-54496| acknowledging to slack before hand so to not time out

* TP-54496| modified log entity field justification

---------

Co-authored-by: Shashank Shekhar <shashank.shekhar@navi.com>
2024-02-07 18:11:50 +05:30

20 lines
393 B
Go

package structUtil
import "encoding/json"
func StructToString(structData interface{}) (string, error) {
jsonData, err := json.Marshal(structData)
if err != nil {
return "", err
}
return string(jsonData), nil
}
func StringToStruct(stringData string, structData interface{}) error {
err := json.Unmarshal([]byte(stringData), &structData)
if err != nil {
return err
}
return nil
}