Skip to content

Commit c38bb77

Browse files
author
pzrr@qq.com
committed
#### Version 1.4.5
* 新增yaml格式配置文件支持,具体参考 example/config/dotweb.yaml * config新增UnmarshalYaml\MarshalYaml\MarshalYamlString,提供针对Yaml的常规处理 * config新增UnmarshalXML\MarshalXML\MarshalXMLString,提供针对Xml的常规处理 * config新增UnmarshalJSON\MarshalJSON\MarshalJSONString,提供针对Json的常规处理 * UploadFile新增Bytes接口,用于返回上传文件本身 * 完善 example/config * 移除 example/session,查看更多示例,请移步https://github.com/devfeel/dotweb-example * 2018-01-20 23:40
1 parent ba4777b commit c38bb77

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

config/config_json.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import "encoding/json"
44

55
// UnmarshalJson parses the JSON-encoded data and stores the result
66
// in the value pointed to by v.
7-
func UnmarshalJson(content []byte, v interface{}) error {
7+
func UnmarshalJSON(content []byte, v interface{}) error {
88
return json.Unmarshal(content, v)
99
}
1010

1111
// MarshalJson returns the JSON encoding of v.
12-
func MarshalJson(v interface{}) (out []byte, err error) {
12+
func MarshalJSON(v interface{}) (out []byte, err error) {
1313
return json.Marshal(v)
1414
}
1515

1616
// MarshalJsonString returns the JSON encoding string format of v.
17-
func MarshalJsonString(v interface{}) (out string) {
17+
func MarshalJSONString(v interface{}) (out string) {
1818
marshal, err := json.Marshal(v)
1919
if err != nil {
2020
return ""

config/config_xml.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import (
88
// the value pointed to by v, which must be an arbitrary struct,
99
// slice, or string. Well-formed data that does not fit into v is
1010
// discarded.
11-
func UnmarshalXml(content []byte, v interface{}) error {
11+
func UnmarshalXML(content []byte, v interface{}) error {
1212
return xml.Unmarshal(content, v)
1313
}
1414

1515
// MarshalXml returns the XML encoding of v.
16-
func MarshalXml(v interface{}) (out []byte, err error) {
16+
func MarshalXML(v interface{}) (out []byte, err error) {
1717
return xml.Marshal(v)
1818
}
1919

2020
// MarshalXmlString returns the XML encoding string format of v.
21-
func MarshalXmlString(v interface{}) (out string) {
21+
func MarshalXMLString(v interface{}) (out string) {
2222
marshal, err := xml.Marshal(v)
2323
if err != nil {
2424
return ""

config/configs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ func InitConfig(configFile string, confType ...interface{}) (config *Config, err
160160
}
161161

162162
if cType == ConfigType_Xml {
163-
config, err = initConfig(realFile, cType, UnmarshalXml)
163+
config, err = initConfig(realFile, cType, UnmarshalXML)
164164
} else if cType == ConfigType_Yaml {
165165
config, err = initConfig(realFile, cType, UnmarshalYaml)
166166
} else {
167-
config, err = initConfig(realFile, cType, UnmarshalJson)
167+
config, err = initConfig(realFile, cType, UnmarshalJSON)
168168
}
169169

170170
if err != nil {

version.MD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#### Version 1.4.5
44
* 新增yaml格式配置文件支持,具体参考 example/config/dotweb.yaml
55
* config新增UnmarshalYaml\MarshalYaml\MarshalYamlString,提供针对Yaml的常规处理
6-
* config新增UnmarshalXml\MarshalXml\MarshalXmlString,提供针对Xml的常规处理
7-
* config新增UnmarshalJson\MarshalJson\MarshalJsonString,提供针对Json的常规处理
6+
* config新增UnmarshalXML\MarshalXML\MarshalXMLString,提供针对Xml的常规处理
7+
* config新增UnmarshalJSON\MarshalJSON\MarshalJSONString,提供针对Json的常规处理
88
* UploadFile新增Bytes接口,用于返回上传文件本身
99
* 完善 example/config
1010
* 移除 example/session,查看更多示例,请移步https://github.com/devfeel/dotweb-example

0 commit comments

Comments
 (0)