mapper

A simple and easy go tools for auto mapper map to struct, struct to map, struct to struct, slice to slice, map to slice, map to json.

MIT License

Stars
379

Bot releases are hidden (Show)

mapper - Feature: Added the "composite-field" tag to mapping composite fields Latest Release

Published by devfeel over 1 year ago

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:
  // 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
mapper - BugFix: remove go mod file.

Published by devfeel over 2 years ago

Version 0.7.10

  • BugFix: remove go mod file.
  • 2022-04-20 20:00 in ShangHai
mapper - add feature flag for ignore tag

Published by devfeel over 2 years ago

Version 0.7.9

  • Feature: add feature flag for ignore tag.
  • Tips: about "-" we keep default behavior as previous version by default, which is use field name as key when mapping structure.
  • Tips: now you can use SetEnableFieldIgnoreTag function to enable this flag right now
  • 2022-04-17 21:00 in ShangHai
mapper - Refactor: use mapperObject refactored the static version implementation

Published by devfeel over 2 years ago

Version 0.7.8

  • Refactor: use mapperObject refactored the static version implementation.
  • 2022-04-16 10:00 in ShangHai

thanks @devfeel

mapper - add object-oriented api for mapper

Published by shyandsy over 2 years ago

feature:

  • add object-oriented API for mapper which allow users to change lots of switch dynamically by calling SetEnabledMapperTag, SetEnabledJsonTag, and so on

thanks @shyandsy

mapper - add SetEnabledMapperTag and SetEnabledJsonTag

Published by devfeel over 2 years ago

Version 0.7.6

  • Feature: add SetEnabledMapperTag to set enabled flag for 'Mapper' tag check
  • Feature: add SetEnabledJsonTag to set enabled flag for 'Json' tag check
  • Ops: add some test cases
  • Tips: Thanks to @aeramu for issue https://github.com/devfeel/mapper/issues/12
  • 2021-10-19 12:00 in ShangHai
mapper - Support for *[] to *[] and definitive error messages

Published by devfeel over 3 years ago

Version 0.7.5

  • Feature: Support for *[] to *[] with MapperSlice
  • Ops: Definitive error messages
  • Tips: Merge pull request #9 from MrWormHole/master, Thanks to @MrWormHole
  • 2021-01-26 12:00 in ShangHai
mapper - add MapToSlice and support mapper struct to map

Published by devfeel over 4 years ago

Version 0.7.4

  • Feature: AutoMapper&Mapper support mapper struct to map[string]interface{}
  • Feature: add MapToSlice to mapper from map[string]interface{} to a slice of any type's ptr
  • Refactor: set MapperMapSlice to Deprecated, will remove on v1.0
  • 2020-06-07 16:00 in ShangHai
mapper - MapperSlice & MapperMapSlice support ptr and struct

Published by devfeel almost 5 years ago

Version 0.7.2

  • New Feature: MapperSlice support ptr and struct
  • New Feature: MapperMapSlice support ptr and struct
  • Detail:
    • now support two slice's element type is ptr or struct in MapperSlice
    • now support slice's element type is ptr or struct in MapperMapSlice
    • About MapperMapSlice:
      //view test code in mapper_test.go:Test_MapperSlice\Test_MapperStructSlice
      //type ptr
      var toSlice []*testStruct
      //type struct
      var toSlice []testStruct
    
    • About MapperSlice:
      //view test code in mapper_test.go:Test_MapperMapSlice\Test_MapperStructMapSlice
      //type ptr
      var fromSlice []*FromStruct
      var toSlice []*ToStruct
      //type struct
      var fromSlice []FromStruct
      var toSlice []ToStruct
    
  • 2019-11-03 16:00 in ShangHai