Documentation ¶
Index ¶
Constants ¶
const ( NilFlag byte = 0 NotNilFlag byte = 1 )
NilFlag and NotNilFlag are used to indicate whether a pointer/interface type field inside struct is nil or not. like a structure:
type MyStruct struct { a *OtherStruct }
Once a is nil, we should hash the NilFlag, otherwise, we should hash the NotNilFlag nil : [0] not nil : [1] [xxx] the NotNilFlag should not be missed, otherwise, once [xxx] is []byte{0}, it will be treated as nil.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Equals ¶
Equals is the interface for equality check. When we need to compare two objects when countering hash conflicts, we can use this interface to check whether they are equal.
type Hash64 ¶
type Hash64 interface { // Hash64 returns the uint64 digest of an object. Hash64(h Hasher) }
Hash64 is the interface for hashcode. It is used to calculate the lossy digest of an object to return uint64 rather than compacted bytes from cascaded operators bottom-up.
type HashEquals ¶
HashEquals is the interface for hash64 and equality check.
type Hasher ¶
type Hasher interface { HashBool(val bool) HashInt(val int) HashInt64(val int64) HashUint64(val uint64) HashFloat64(val float64) HashRune(val rune) HashString(val string) HashByte(val byte) HashBytes(val []byte) Reset() SetCache([]byte) Cache() []byte Sum64() uint64 }
Hasher is the interface for computing hash values of different types.