Skip to content

Commit

Permalink
Update readme to reflect the new functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Emīls Piņķis committed Feb 13, 2018
1 parent 0eb83b5 commit b797d70
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,26 @@ A sample example that we use the structextract with [Squirrel](https://github.co
//Make the sql request..
```

#### Now with support for embedded structs
```go
type SampleInner struct {
Inner string `json:"inner"`
}

type SampleOuter struct {
SampleInner
Field string `json:"field"`
}

ss := SampleOuter{SampleInner{"inner"}, "outer"}

ext := structextract.New(&ss).UseEmbeddedStructs(true)

jsonMap, err := ext.FieldValueFromTagMap("json")
// jsonMap here would be equal to the following map
m := map[string]interface{}{
"field": "outer",
"inner": "inner",
}
```

0 comments on commit b797d70

Please sign in to comment.