Files
gf/encoding/gparser/gparser_api_encoding.go

44 lines
1.1 KiB
Go
Raw Normal View History

2019-05-08 22:04:36 +08:00
// Copyright 2017 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://gitee.com/johng/gp.
package gparser
2019-06-19 09:06:52 +08:00
func VarToXml(value interface{}, rootTag ...string) ([]byte, error) {
return New(value).ToXml(rootTag...)
2019-05-08 22:04:36 +08:00
}
2019-06-19 09:06:52 +08:00
func VarToXmlIndent(value interface{}, rootTag ...string) ([]byte, error) {
return New(value).ToXmlIndent(rootTag...)
2019-05-08 22:04:36 +08:00
}
func VarToJson(value interface{}) ([]byte, error) {
2019-06-19 09:06:52 +08:00
return New(value).ToJson()
2019-05-08 22:04:36 +08:00
}
2019-05-11 17:56:14 +08:00
func VarToJsonString(value interface{}) (string, error) {
return New(value).ToJsonString()
}
2019-05-08 22:04:36 +08:00
func VarToJsonIndent(value interface{}) ([]byte, error) {
2019-05-11 17:56:14 +08:00
return New(value).ToJsonIndent()
}
func VarToJsonIndentString(value interface{}) (string, error) {
return New(value).ToJsonIndentString()
2019-05-08 22:04:36 +08:00
}
func VarToYaml(value interface{}) ([]byte, error) {
2019-06-19 09:06:52 +08:00
return New(value).ToYaml()
2019-05-08 22:04:36 +08:00
}
func VarToToml(value interface{}) ([]byte, error) {
2019-06-19 09:06:52 +08:00
return New(value).ToToml()
2019-05-08 22:04:36 +08:00
}
2019-08-12 16:53:07 +08:00
func VarToIni(value interface{}) ([]byte, error) {
return New(value).ToIni()
}