Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Marshal func(in interface{}) (out []byte, err error) = yaml.Marshal
Marshal
PS: 需要搭配 yaml tag 一起使用,不识别 json tag.
View Source
var Unmarshal func(in []byte, out interface{}) (err error) = yaml.Unmarshal
Unmarshal
Deprecated: Use confKit.MustLoad || confKit.LoadFromYamlBytes instead.
PS: 需要搭配 yaml tag 一起使用,不识别 json tag.
Functions ¶
func MarshalToFile ¶ added in v2.2.2
MarshalToFile
PS: (1) 需要搭配 yaml tag 一起使用,不识别 json tag. (2) 对 传参filePath 的验证和断言在 fileKit.WriteToFile 里面.
@param in 建议为结构体实例指针 || map实例 || slice实例 @param filePath (1) .yaml 格式的文件
(2) 不存在的话,会创建一个新的文件 (3) 存在且是个文件的话,会 "覆盖" 掉旧的(并不会加到该文件的最后面)
func MarshalToFileWithJsonTag ¶ added in v2.2.5
MarshalToFileWithJsonTag
PS: (1) 适用场景: 有json tag,没有yaml tag. (2) 缺陷: (a) 传参in 不能为slice实例;
(b) map是无序的键值对集合,生成的yaml会有点乱(即使按照key排序); (c) key中如果有大写字母,全部会变成小写字母.
func MarshalToString ¶
MarshalToString
PS: 需要搭配 yaml tag 一起使用,不识别 json tag.
@param in 建议为结构体实例指针 || map实例 || slice实例
func UnmarshalFromString
deprecated
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.