改进gdb.Result/Recorde ToXml方法,增加可选的rootTag参数

This commit is contained in:
john
2018-08-23 18:26:29 +08:00
parent 735b27b534
commit 569be7e773
2 changed files with 4 additions and 4 deletions

View File

@ -18,8 +18,8 @@ func (r Record) ToJson() string {
}
// 将记录结果转换为XML字符串
func (r Record) ToXml() string {
content, _ := gparser.VarToXml(r.ToMap())
func (r Record) ToXml(rootTag...string) string {
content, _ := gparser.VarToXml(r.ToMap(), rootTag...)
return string(content)
}

View File

@ -17,8 +17,8 @@ func (r Result) ToJson() string {
}
// 将结果集转换为JSON字符串
func (r Result) ToXml() string {
content, _ := gparser.VarToXml(r.ToList())
func (r Result) ToXml(rootTag...string) string {
content, _ := gparser.VarToXml(r.ToList(), rootTag...)
return string(content)
}