Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
darylnwk committed Mar 7, 2020
1 parent 955f45e commit 59bd3bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# flatten
Flatten Go structs with JSON tags
--
import "github.com/darylnwk/flatten"


## Usage

#### func Struct

```go
func Struct(s interface{}, m map[string]interface{})
```
Struct parses a struct `s` with JSON tags and flattens nested parameters to only
one level and passes the result to `m`.
3 changes: 2 additions & 1 deletion flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (
"strings"
)

// Struct flattens a struct with json tags
// Struct parses a struct `s` with JSON tags and flattens nested parameters
// to only one level and passes the result to `m`.
func Struct(s interface{}, m map[string]interface{}) {
flatten("", s, m)
}
Expand Down

0 comments on commit 59bd3bc

Please sign in to comment.