Documentation
¶
Overview ¶
Package smap provides functionality to merge struct fields based on struct tags.
Index ¶
Constants ¶
View Source
const TagKey = "smap"
TagKey is the struct tag key used to define source paths.
Variables ¶
View Source
var ( ErrDstInvalid = errors.New("invalid dst: non-nil struct ptr required") ErrSrcInvalid = errors.New("invalid src: struct or non-nil ptr required") ErrTagInvalid = errors.New("invalid path in tag") ErrFieldTypesIncompatible = errors.New("source field type is incompatible with destination field type") ErrTagEmpty = errors.New("empty smap tag") ErrTagPathNotFound = errors.New("tag path field not found") ErrTagPathEmpty = errors.New("tag path is empty") ErrTagPathInvalidKeyType = errors.New("tag path key type cannot be converted") // Updated )
Sentinel errors for API consumers to detect via errors.Is.
Functions ¶
Types ¶
type MergeFieldError ¶
type MergeFieldError struct {
TagValue string // Relevant tag or path portion
DstTypeName string // Destination type name
SrcTypeName string // Source type name
// contains filtered or unexported fields
}
MergeFieldError is a complex error type for mergeField failures.
func NewMergeFieldError ¶
func NewMergeFieldError(child error, tagValue, dstTypeName, srcTypeName string) *MergeFieldError
NewMergeFieldError constructs a MergeFieldError with the given details.
func (*MergeFieldError) Error ¶
func (e *MergeFieldError) Error() string
Error implements the error interface.
func (*MergeFieldError) Unwrap ¶
func (e *MergeFieldError) Unwrap() error
Unwrap returns the underlying error for errors.Is checks.
Click to show internal directories.
Click to hide internal directories.