fatih / structs

Utilities for Go structs

Home Page:http://godoc.org/github.com/fatih/structs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Omitempty option for creating maps

klauspost opened this issue · comments

It would be lovely to have an ",omitempty" option to struct members, so they can be omitted if empty similar to the json encoder.

Sounds a good idea! I'll look into it, thanks!

Thanks!

This is merged now. Please refer to the doc for more info: http://godoc.org/github.com/fatih/structs#Struct.Map I'll add this functionality to Fields and Values method too so it's in sync with them. Thanks for the tip again and let me know if you hit problems.

Thanks a lot!