From 47335a97c03f14e6ffcdeb7778db9427642a89da Mon Sep 17 00:00:00 2001 From: zhuxiujia Date: Wed, 1 Jul 2020 10:30:48 +0800 Subject: [PATCH] rename method --- GoMybatisSqlResultDecoder.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/GoMybatisSqlResultDecoder.go b/GoMybatisSqlResultDecoder.go index 12e934c..f91fbc9 100644 --- a/GoMybatisSqlResultDecoder.go +++ b/GoMybatisSqlResultDecoder.go @@ -123,7 +123,7 @@ func makeJsonObjBytes(resultMap map[string]*ResultProperty, sqlData map[string][ } if isStringType { jsonData.WriteString("\"") - jsonData.WriteString(sqlVEncode(sqlV)) + jsonData.WriteString(encodeStringValue(sqlV)) jsonData.WriteString("\"") } else { if sqlV == nil || len(sqlV) == 0 { @@ -141,10 +141,13 @@ func makeJsonObjBytes(resultMap map[string]*ResultProperty, sqlData map[string][ return []byte(jsonData.String()) } -func sqlVEncode(v []byte) string { - if v == nil || len(v) == 0 { +func encodeStringValue(v []byte) string { + if v == nil { return "null" } + if len(v) == 0 { + return "" + } var s = string(v) var b, e = json.Marshal(s) if e != nil || len(b) == 0 {