19 lines
245 B
Go
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
|
||
|
}
|