summaryrefslogtreecommitdiff
path: root/vendor/github.com/imdario/mergo/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/imdario/mergo/README.md')
-rw-r--r--vendor/github.com/imdario/mergo/README.md29
1 files changed, 8 insertions, 21 deletions
diff --git a/vendor/github.com/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md
index b1310697..f4769cdd 100644
--- a/vendor/github.com/imdario/mergo/README.md
+++ b/vendor/github.com/imdario/mergo/README.md
@@ -30,7 +30,7 @@ If you were using Mergo **before** April 6th 2015, please check your project wor
### Mergo in the wild
- [docker/docker](https://github.com/docker/docker/)
-- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes)
+- [GoogleCloudPlatform/kubernetes](https://github.com/GoogleCloudPlatform/kubernetes)
- [imdario/zas](https://github.com/imdario/zas)
- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy)
- [EagerIO/Stout](https://github.com/EagerIO/Stout)
@@ -50,7 +50,6 @@ If you were using Mergo **before** April 6th 2015, please check your project wor
- [thoas/picfit](https://github.com/thoas/picfit)
- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server)
- [jnuthong/item_search](https://github.com/jnuthong/item_search)
-- [Iris Web Framework](https://github.com/kataras/iris)
## Installation
@@ -65,27 +64,15 @@ If you were using Mergo **before** April 6th 2015, please check your project wor
You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. Also maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection).
-```go
-if err := mergo.Merge(&dst, src); err != nil {
- // ...
-}
-```
-
-Also, you can merge overwriting values using MergeWithOverwrite.
-
-```go
-if err := mergo.MergeWithOverwrite(&dst, src); err != nil {
- // ...
-}
-```
+ if err := mergo.Merge(&dst, src); err != nil {
+ // ...
+ }
Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field.
-```go
-if err := mergo.Map(&dst, srcMap); err != nil {
- // ...
-}
-```
+ if err := mergo.Map(&dst, srcMap); err != nil {
+ // ...
+ }
Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as map[string]interface{}. They will be just assigned as values.
@@ -109,11 +96,11 @@ type Foo struct {
func main() {
src := Foo{
A: "one",
- B: 2,
}
dest := Foo{
A: "two",
+ B: 2,
}
mergo.Merge(&dest, src)