Tags: devfeel/mapper
Tags
#### Version 0.7.14
* Feature: Implement variable arguments based on NewMapper for flexible configuration settings when you init mapper.
* Feature: Add Setting struct used to Config mapper
* you can use like this:
``` go
// Default Setting:
// EnabledTypeChecking: false,
// EnabledMapperStructField: true,
// EnabledAutoTypeConvert: true,
// EnabledMapperTag: true,
// EnabledJsonTag: true,
// EnabledCustomTag: false,
// EnableFieldIgnoreTag: false,
/// When you use default setting
NewMapper()
/// When you will change some setting
NewMapper(CTypeChecking(true), CCustomTagName("-"))
```
* 2024-09-06 19:00 in ShangHai
#### Version 0.7.13 * Feature: Added the "composite-field" tag to continue expanding and searching for corresponding field mappings when encountering composite fields in a Struct. Currently, only one level of expansion is supported. * Tips: Thanks to @naeemaei for issue #39 * For my birthday! * you can use like this: ``` go // Base model type BaseModel struct { Id int `json:"id"` } // Country model type Country struct { BaseModel `json:"composite-field"` Name string `json:"name"` } ``` * 2023-04-15 19:00 in ShangHai
#### Version 0.7.4
* Feature: AutoMapper&Mapper support mapper struct to map[string]interface{}
* Refactor: set MapperMapSlice to Deprecated, will remove on v1.0
* About AutoMapper::
```
func Test_AutoMapper_StructToMap(t *testing.T) {
from := &FromStruct{Name: "From", Sex: true, AA: "AA"}
to := make(map[string]interface{})
err := AutoMapper(from, &to)
if err != nil {
t.Error("RunResult error: mapper error", err)
} else {
if to["UserName"] == "From"{
t.Log("RunResult success:", to)
}else{
t.Error("RunResult failed: map[UserName]", to["UserName"])
}
}
}
```
* 2020-06-07 16:00 in ShangHai
PreviousNext