Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add func StringMapE #2

Closed
shockerli opened this issue Nov 28, 2021 · 0 comments
Closed

Add func StringMapE #2

shockerli opened this issue Nov 28, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@shockerli
Copy link
Owner

shockerli commented Nov 28, 2021

func

func StringMapE(val interface{}) (m map[string]interface{}, err error)

feature

  • Support JSON string of map
// input
`{"name":"cvt","age":3.21}`

// expect
map[string]interface{}{"name": "cvt", "age": 3.21} 
  • Support any map type
// input
map[interface{}]interface{}{111: "cvt", "222": 3.21}

// expect
map[string]interface{}{"111": "cvt", "222": 3.21}
  • Support any struct type
// input
struct {
    Name string
    Age  int
}{"cvt", 3}

// expect
map[string]interface{}{"Name": "cvt", "Age": 3}
@shockerli shockerli added the enhancement New feature or request label Nov 28, 2021
@shockerli shockerli self-assigned this Nov 28, 2021
shockerli added a commit that referenced this issue Nov 28, 2021
* Support JSON string of map
* Support any `map` type
* Support any `struct` type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant