Skip to content

Commit

Permalink
清理数据
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Mar 2, 2019
1 parent 07be35e commit 237dbf3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion ast/Node.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ func DoChildNodes(childNodes []Node, env map[string]interface{}) ([]byte, error)
sql.Write(r)
}
}
return sql.Bytes(), nil
var bytes = sql.Bytes()
sql.Reset()
return bytes, nil
}
6 changes: 4 additions & 2 deletions ast/NodeForEach.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@ func (it *NodeForEach) Eval(env map[string]interface{}) ([]byte, error) {
}
var newTempSql bytes.Buffer
var tempSqlString = bytes.Trim(tempSql.Bytes(), it.separator)
tempSql.Reset()
newTempSql.WriteString(it.open)
newTempSql.Write(tempSqlString)
newTempSql.WriteString(it.close)
tempSql.Reset()
return newTempSql.Bytes(), nil
var newTempSqlBytes=newTempSql.Bytes()
newTempSql.Reset()
return newTempSqlBytes, nil
}

5 changes: 4 additions & 1 deletion ast/NodeTrim.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ func (it *NodeTrim) Eval(env map[string]interface{}) ([]byte, error) {
newBuffer.Write(sql)
newBuffer.WriteString(` `)
newBuffer.Write(it.suffix)
return newBuffer.Bytes(), nil

var newBufferBytes=newBuffer.Bytes()
newBuffer.Reset()
return newBufferBytes, nil
}

0 comments on commit 237dbf3

Please sign in to comment.