diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/mitchellh/hashstructure/README.md | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/mitchellh/hashstructure/README.md')
-rw-r--r-- | vendor/github.com/mitchellh/hashstructure/README.md | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/vendor/github.com/mitchellh/hashstructure/README.md b/vendor/github.com/mitchellh/hashstructure/README.md index 7d0de5b..28ce45a 100644 --- a/vendor/github.com/mitchellh/hashstructure/README.md +++ b/vendor/github.com/mitchellh/hashstructure/README.md | |||
@@ -1,4 +1,4 @@ | |||
1 | # hashstructure | 1 | # hashstructure [![GoDoc](https://godoc.org/github.com/mitchellh/hashstructure?status.svg)](https://godoc.org/github.com/mitchellh/hashstructure) |
2 | 2 | ||
3 | hashstructure is a Go library for creating a unique hash value | 3 | hashstructure is a Go library for creating a unique hash value |
4 | for arbitrary values in Go. | 4 | for arbitrary values in Go. |
@@ -19,6 +19,9 @@ sending data across the network, caching values locally (de-dup), and so on. | |||
19 | 19 | ||
20 | * Optionally specify a custom hash function to optimize for speed, collision | 20 | * Optionally specify a custom hash function to optimize for speed, collision |
21 | avoidance for your data set, etc. | 21 | avoidance for your data set, etc. |
22 | |||
23 | * Optionally hash the output of `.String()` on structs that implement fmt.Stringer, | ||
24 | allowing effective hashing of time.Time | ||
22 | 25 | ||
23 | ## Installation | 26 | ## Installation |
24 | 27 | ||
@@ -34,28 +37,29 @@ For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/has | |||
34 | 37 | ||
35 | A quick code example is shown below: | 38 | A quick code example is shown below: |
36 | 39 | ||
37 | 40 | ```go | |
38 | type ComplexStruct struct { | 41 | type ComplexStruct struct { |
39 | Name string | 42 | Name string |
40 | Age uint | 43 | Age uint |
41 | Metadata map[string]interface{} | 44 | Metadata map[string]interface{} |
42 | } | 45 | } |
43 | 46 | ||
44 | v := ComplexStruct{ | 47 | v := ComplexStruct{ |
45 | Name: "mitchellh", | 48 | Name: "mitchellh", |
46 | Age: 64, | 49 | Age: 64, |
47 | Metadata: map[string]interface{}{ | 50 | Metadata: map[string]interface{}{ |
48 | "car": true, | 51 | "car": true, |
49 | "location": "California", | 52 | "location": "California", |
50 | "siblings": []string{"Bob", "John"}, | 53 | "siblings": []string{"Bob", "John"}, |
51 | }, | 54 | }, |
52 | } | 55 | } |
53 | 56 | ||
54 | hash, err := hashstructure.Hash(v, nil) | 57 | hash, err := hashstructure.Hash(v, nil) |
55 | if err != nil { | 58 | if err != nil { |
56 | panic(err) | 59 | panic(err) |
57 | } | 60 | } |
58 | 61 | ||
59 | fmt.Printf("%d", hash) | 62 | fmt.Printf("%d", hash) |
60 | // Output: | 63 | // Output: |
61 | // 2307517237273902113 | 64 | // 2307517237273902113 |
65 | ``` | ||