Merge pull request #17961 from hashicorp/f-HashInt

Add a HashInt helper/schema function
This commit is contained in:
kt 2018-06-18 09:25:17 -07:00 committed by GitHub
commit b95f74956a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -17,6 +17,12 @@ func HashString(v interface{}) int {
return hashcode.String(v.(string)) return hashcode.String(v.(string))
} }
// HashInt hashes integers. If you want a Set of integers, this is the
// SchemaSetFunc you want.
func HashInt(v interface{}) int {
return hashcode.String(strconv.Itoa(v.(int)))
}
// HashResource hashes complex structures that are described using // HashResource hashes complex structures that are described using
// a *Resource. This is the default set implementation used when a set's // a *Resource. This is the default set implementation used when a set's
// element type is a full resource. // element type is a full resource.