Documentation
¶
Index ¶
- func DeepCopy[T any](obj T, opts ...Option) T
- func DeepCopyWithoutSecrets[T any](obj T, opts ...Option) T
- func RemoveSecrets[T any, PTR Pointer[T]](obj PTR)
- func Traverse(obj any, visitorFunc VisitorFunc) error
- type Hash
- type HashBuilder
- type Option
- type OptionWithUnexported
- type OptionWithVisitorFunc
- type Options
- type Pointer
- type ProcContext
- type VisitorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepCopy ¶
DeepCopy returns a deep copy of the object.
Keep in mind, by default it does not copy unexported data (unless option `WithUnexported(true)` is provided).
func DeepCopyWithoutSecrets ¶
DeepCopyWithoutSecrets returns a deep copy of the object, but with all fields tagged as `secret:""` reset to their zero values.
Keep in mind, this function does not censor: * the internals of: channels, function values, uintptr-s and unsafe.Pointer-s; * the keys of maps.
Also, it does not copy unexported data.
func RemoveSecrets ¶
RemoveSecrets returns zero-s all fields tagged as `secret:""`.
Keep in mind, this function does not zero: * the internals of: channels, function values, uintptr-s and unsafe.Pointer-s; * the keys of maps.
Also, it does not copy unexported data!
func Traverse ¶
func Traverse( obj any, visitorFunc VisitorFunc, ) error
Traverse recursively traverses the object `obj`.
Types ¶
type Hash ¶
type Hash []byte
Hash is a hash of an value/object.
func CalcCryptoHash ¶
CalcCryptoHash returns a cryptographically secure hash of an arbitrary set of values.
type HashBuilder ¶
type HashBuilder struct {
HashValue hash.Hash
StableHashing bool
// contains filtered or unexported fields
}
HashBuilder is the handler which converts a set of variables to a Hash.
func NewHashBuilderStable ¶
func NewHashBuilderStable(hash hash.Hash) *HashBuilder
NewBuilderStable returns a new instance of HashBuilder that builds stable hashes (that do not change for the same object after each restart of the program).
func NewHashBuilderUnstable ¶
func NewHashBuilderUnstable(hash hash.Hash) *HashBuilder
NewBuilderUnstable returns a new instance of HashBuilder that builds unstable hashes (that change for the same object after each restart of the program).
func (*HashBuilder) ResetAndHash ¶
func (b *HashBuilder) ResetAndHash(args ...any) (Hash, error)
ResetAndHash resets the state of the hash, calculates a new hash using given arguments, and returns it's value.
func (*HashBuilder) Write ¶
func (b *HashBuilder) Write(args ...any) error
Write adds more measurements to the current hash.
type OptionWithUnexported ¶
type OptionWithUnexported bool
type OptionWithVisitorFunc ¶
type OptionWithVisitorFunc VisitorFunc
type ProcContext ¶
type ProcContext struct {
// CustomData is overwritable and all the children in the tree
// will receive this provided value.
CustomData any
// contains filtered or unexported fields
}
ProcContext is a structure provided to a callback on every call.
func (*ProcContext) Depth ¶
func (ctx *ProcContext) Depth() uint
func (*ProcContext) Next ¶
func (ctx *ProcContext) Next(pathPart string) *ProcContext
func (*ProcContext) Parent ¶
func (ctx *ProcContext) Parent() *ProcContext
func (*ProcContext) Path ¶
func (ctx *ProcContext) Path() string
type VisitorFunc ¶
type VisitorFunc func(*ProcContext, reflect.Value, *reflect.StructField) (reflect.Value, bool, error)
VisitorFunc is called on every node during a traversal.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
censoredvalue
command
|
|
|
customprocessing
command
|
|
|
deepcopy
command
|