mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 04:07:47 +08:00
add MustEncodeString for package gjson
This commit is contained in:
parent
984e5f98f7
commit
ca5c0cc84d
@ -34,6 +34,12 @@ func MustEncode(value interface{}) []byte {
|
||||
return b
|
||||
}
|
||||
|
||||
// MustEncodeString encodes any golang variable `value` to JSON string.
|
||||
// It panics if any error occurs.
|
||||
func MustEncodeString(value interface{}) string {
|
||||
return string(MustEncode(value))
|
||||
}
|
||||
|
||||
// Decode decodes json format `data` to golang variable.
|
||||
// The parameter `data` can be either bytes or string type.
|
||||
func Decode(data interface{}) (interface{}, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user