diff options
author | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:07 -0400 |
---|---|---|
committer | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:07 -0400 |
commit | bae9f6d2fd5eb5bc80929bd393932b23f14d7c93 (patch) | |
tree | ca9ab12a7d78b1fc27a8f734729081357ce6d252 /vendor/github.com/mitchellh/hashstructure/README.md | |
parent | 254c495b6bebab3fb72a243c4bce858d79e6ee99 (diff) | |
download | terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.tar.gz terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.tar.zst terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.zip |
Initial transfer of provider code
Diffstat (limited to 'vendor/github.com/mitchellh/hashstructure/README.md')
-rw-r--r-- | vendor/github.com/mitchellh/hashstructure/README.md | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/vendor/github.com/mitchellh/hashstructure/README.md b/vendor/github.com/mitchellh/hashstructure/README.md new file mode 100644 index 0000000..7d0de5b --- /dev/null +++ b/vendor/github.com/mitchellh/hashstructure/README.md | |||
@@ -0,0 +1,61 @@ | |||
1 | # hashstructure | ||
2 | |||
3 | hashstructure is a Go library for creating a unique hash value | ||
4 | for arbitrary values in Go. | ||
5 | |||
6 | This can be used to key values in a hash (for use in a map, set, etc.) | ||
7 | that are complex. The most common use case is comparing two values without | ||
8 | sending data across the network, caching values locally (de-dup), and so on. | ||
9 | |||
10 | ## Features | ||
11 | |||
12 | * Hash any arbitrary Go value, including complex types. | ||
13 | |||
14 | * Tag a struct field to ignore it and not affect the hash value. | ||
15 | |||
16 | * Tag a slice type struct field to treat it as a set where ordering | ||
17 | doesn't affect the hash code but the field itself is still taken into | ||
18 | account to create the hash value. | ||
19 | |||
20 | * Optionally specify a custom hash function to optimize for speed, collision | ||
21 | avoidance for your data set, etc. | ||
22 | |||
23 | ## Installation | ||
24 | |||
25 | Standard `go get`: | ||
26 | |||
27 | ``` | ||
28 | $ go get github.com/mitchellh/hashstructure | ||
29 | ``` | ||
30 | |||
31 | ## Usage & Example | ||
32 | |||
33 | For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/hashstructure). | ||
34 | |||
35 | A quick code example is shown below: | ||
36 | |||
37 | |||
38 | type ComplexStruct struct { | ||
39 | Name string | ||
40 | Age uint | ||
41 | Metadata map[string]interface{} | ||
42 | } | ||
43 | |||
44 | v := ComplexStruct{ | ||
45 | Name: "mitchellh", | ||
46 | Age: 64, | ||
47 | Metadata: map[string]interface{}{ | ||
48 | "car": true, | ||
49 | "location": "California", | ||
50 | "siblings": []string{"Bob", "John"}, | ||
51 | }, | ||
52 | } | ||
53 | |||
54 | hash, err := hashstructure.Hash(v, nil) | ||
55 | if err != nil { | ||
56 | panic(err) | ||
57 | } | ||
58 | |||
59 | fmt.Printf("%d", hash) | ||
60 | // Output: | ||
61 | // 2307517237273902113 | ||