hotime/vendor/github.com/go-pay/gopay/pkg/util/string.go
2022-05-24 13:49:25 +08:00

19 lines
245 B
Go

package util
import "encoding/json"
func ConvertToString(v interface{}) (str string) {
if v == nil {
return NULL
}
var (
bs []byte
err error
)
if bs, err = json.Marshal(v); err != nil {
return NULL
}
str = string(bs)
return
}