Documentation
¶
Index ¶
- func BoolToByte(b bool) byte
- func GetPos(r io.Reader) int64
- func GetReaderPos(r io.Reader) (int64, bool)
- func GetStringHashCRC32(s string) (int32, error)
- func GetStringHashFNV1a(s string) (int32, error)
- func GetStringHashSHA256(s string) (int32, error)
- func MergeOrderedMapKeys[K cmp.Ordered, V any](values map[K]V, order []K, label string) ([]K, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetReaderPos ¶
GetReaderPos 获取 io.Reader 的当前位置。 如果 io.Reader 支持 Seek,返回当前位置。 如果不支持 Seek,返回 -1, false。
func GetStringHashCRC32 ¶
GetStringHashCRC32 计算字符串的哈希值并返回一个 int32 类型的值。 这个函数使用了 CRC-32 哈希算法,将字符串转换为一个 32 位的哈希值。
func GetStringHashFNV1a ¶
GetStringHashFNV1a 计算字符串的哈希值并返回一个 int32 类型的值。 这个函数使用了 FNV-1a 哈希算法,将字符串转换为一个 32 位的哈希值。
func GetStringHashSHA256 ¶
GetStringHashSHA256 计算字符串的哈希值并返回一个 int32 类型的值。 这个函数使用了 SHA-256 哈希算法,将字符串转换为一个 32 位的哈希值。 由于 SHA-256 哈希算法的输出是一个 256 位的哈希值,这里只取前 32 位作为返回值。
func MergeOrderedMapKeys ¶
func MergeOrderedMapKeys[K cmp.Ordered, V any](values map[K]V, order []K, label string) ([]K, error)
MergeOrderedMapKeys treats order as optional round-trip metadata. Keys that are still present retain their recorded order, stale keys are ignored, and newly added keys are appended in their natural order. A duplicate live key remains an error because it cannot be emitted twice while retaining the map's declared count.
Types ¶
This section is empty.