Documentation
¶
Index ¶
- func HashFiles(filePaths ...string) (string, error)
- func HashStruct(v interface{}, options StructHasherOptions) (string, error)
- type StructHasher
- func (s *StructHasher) Array(v reflect.Value) error
- func (s *StructHasher) ArrayElem(i int, v reflect.Value) error
- func (s *StructHasher) Enter(location reflectwalk.Location) error
- func (s *StructHasher) Exit(location reflectwalk.Location) error
- func (s *StructHasher) Map(v reflect.Value) error
- func (s *StructHasher) MapElem(m, k, v reflect.Value) error
- func (s *StructHasher) Primitive(v reflect.Value) error
- func (s *StructHasher) Slice(v reflect.Value) error
- func (s *StructHasher) SliceElem(i int, v reflect.Value) error
- func (s *StructHasher) Struct(v reflect.Value) error
- func (s *StructHasher) StructField(field reflect.StructField, v reflect.Value) error
- type StructHasherOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashFiles ¶
HashFiles computes a SHA256 hash of multiple files combined Returns the first 12 characters of the hex hash
func HashStruct ¶
func HashStruct(v interface{}, options StructHasherOptions) (string, error)
HashStruct creates a hash of a struct using reflectwalk, ignoring fields marked with `-` in the nuonhash tag
Types ¶
type StructHasher ¶
type StructHasher struct {
// contains filtered or unexported fields
}
StructHasher implements reflectwalk.StructWalker to collect hashable field data
func (*StructHasher) Array ¶
func (s *StructHasher) Array(v reflect.Value) error
Array handles array entries
func (*StructHasher) ArrayElem ¶
func (s *StructHasher) ArrayElem(i int, v reflect.Value) error
ArrayElem handles individual array elements
func (*StructHasher) Enter ¶
func (s *StructHasher) Enter(location reflectwalk.Location) error
Enter is called when entering a new level during walk
func (*StructHasher) Exit ¶
func (s *StructHasher) Exit(location reflectwalk.Location) error
Exit is called when exiting a level during walk
func (*StructHasher) Map ¶
func (s *StructHasher) Map(v reflect.Value) error
Map handles map entries
func (*StructHasher) MapElem ¶
func (s *StructHasher) MapElem(m, k, v reflect.Value) error
MapElem handles individual map elements
func (*StructHasher) Primitive ¶
func (s *StructHasher) Primitive(v reflect.Value) error
Primitive handles primitive value types
func (*StructHasher) Slice ¶
func (s *StructHasher) Slice(v reflect.Value) error
Slice handles slice entries
func (*StructHasher) SliceElem ¶
func (s *StructHasher) SliceElem(i int, v reflect.Value) error
SliceElem handles individual slice elements
func (*StructHasher) Struct ¶
func (s *StructHasher) Struct(v reflect.Value) error
Struct is called for each struct encountered during the walk
func (*StructHasher) StructField ¶
func (s *StructHasher) StructField(field reflect.StructField, v reflect.Value) error
StructField is called for each field in a struct
type StructHasherOptions ¶
type StructHasherOptions struct {
EnableOmitEmpty bool // Flag to enable omitempty handling
}