Documentation
¶
Index ¶
- func GetStringFromObj(obj interface{}) (keyString string)
- func SetUpdateValue(originObjPtr, updateInfoObjPtr interface{}) (changed bool, originMap, changedMap map[string]interface{})
- func SetUpdateValueWithOption(originObjPtr, updateInfoObjPtr interface{}, option *SetUpdateValueOption) (changed bool, originMap, changedMap map[string]interface{})
- type SetUpdateValueOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStringFromObj ¶
func GetStringFromObj(obj interface{}) (keyString string)
GetStringFromObj obj为结构体实例 与test_tool中的GetSubTestName类似 返回值格式:keyName_keyValueString_keyName_keyValueString
func SetUpdateValue ¶
func SetUpdateValue(originObjPtr, updateInfoObjPtr interface{}) (changed bool, originMap, changedMap map[string]interface{})
SetUpdateValue 将updateInfoObj这个结构体实例中的各项更新至originObj中各同名项中。 1. updateInfoObj 中的各项如果不是零值,且与originObj中的对应项值不同,才会更新至originObj 2. originObjPtr 是 originObj的指针;updateInfoObjPtr 是 updateInfoObj的指针 updateInfoObj中的各项如果不是zero value,则将originObj中同名的项的值更新 ! 注意:如果updateInfoObj中有些项刻意置为零值,在这里不会改变,需要额外单独赋值给originObj相应的项。例如,将state置为0,或将某字段置空“” changed: 表示原始值与info中有不同的值 originMap: 如果changed == true,orginMap中列出变动前的项和原始值 changedMap: 如果changed == true,changedMap中列出后的项和值 deprecated, 建议使用SetUpdateValueWithOption
func SetUpdateValueWithOption ¶ added in v1.0.19
func SetUpdateValueWithOption(originObjPtr, updateInfoObjPtr interface{}, option *SetUpdateValueOption) (changed bool, originMap, changedMap map[string]interface{})
changed: 表示原始值被更新 originMap: 如果changed == true,orginMap中列出变动前的项和原始值 changedMap: 如果changed == true,changedMap中列出后的项和值
Types ¶
type SetUpdateValueOption ¶ added in v1.0.19
type SetUpdateValueOption struct {
// 是否将零值更新到originObj中,零值也包含空指针nil
CanSetZero bool
}