Skip to content

Commit

Permalink
rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Jul 1, 2020
1 parent 44d0311 commit 47335a9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions GoMybatisSqlResultDecoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 47335a9

Please sign in to comment.