Documentation ¶
Overview ¶
*
@author: 1043193460@qq.com @date: 2022/12/14 12:02 @note:
*
*
@author: 1043193460@qq.com @date: 2022/12/14 12:02 @note: 这个包首先使用goyaml将YAML转换为JSON,然后使用json。Marshal和json。要转换为结构或从结构转换为结构的反编组 另请参见http://ghodss.com/2014/the-right-way-to-handle-yaml-in-golang
*
*
@author: 1043193460@qq.com @date: 2022/12/14 12:02 @note: 这个文件包含的变化只是兼容1.10和以后。
*
Index ¶
- func DisallowUnknownFields(d *json.Decoder) *json.Decoder
- type JSONOpt
- type YamlUtils
- func (y *YamlUtils) JSONToYAML(j []byte) ([]byte, error)
- func (y *YamlUtils) Marshal(o interface{}) ([]byte, error)
- func (y *YamlUtils) Unmarshal(b []byte, o interface{}, opts ...JSONOpt) error
- func (y *YamlUtils) UnmarshalStrict(b []byte, o interface{}, opts ...JSONOpt) error
- func (y *YamlUtils) YAMLToJSON(b []byte) ([]byte, error)
- func (y *YamlUtils) YAMLToJSONStrict(b []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type YamlUtils ¶
type YamlUtils struct { }
func (*YamlUtils) JSONToYAML ¶
将JSON转换为YAML。
func (*YamlUtils) UnmarshalStrict ¶
UnmarshallStrict与Unmarshall类似重复将导致错误。要严格控制未知字段,请添加DisableUnknownFields选项。
func (*YamlUtils) YAMLToJSON ¶
YAMLToJSON将YAML转换为JSON。由于JSON是YAML的子集,通过此方法传递JSON应该是一个错误。
Click to show internal directories.
Click to hide internal directories.