Documentation ¶
Index ¶
- func AddTypeAliasMap[Name any, Alias any]()
- func Clone[T any](value *T) *T
- func ConvertTo[T any](from any) (T, error)
- func ConvertToKind(from any, toKind reflect.Kind) (any, error)
- func ConvertToKindWithOption(from any, toKind reflect.Kind, option *MapOption) (any, error)
- func ConvertToType(from any, toType reflect.Type) (any, error)
- func ConvertToTypeWithOption(from any, toType reflect.Type, option *MapOption) (any, error)
- func ConvertToWithOption[T any](from any, option *MapOption) (t T, err error)
- func FieldHelper(s any) *fieldHelper
- func GetFieldPath(structField reflect.StructField, rootValues []reflect.Value) string
- func Map(from, to any) error
- func MapToValue(from any, to reflect.Value) error
- func MapToValueWithOption(from any, to reflect.Value, option *MapOption) error
- func MapWithOption(from, to any, option *MapOption) error
- func Must[T any](t T, err error) T
- func MustConvertTo[T any](from any) T
- func MustConvertToKind(from any, toKind reflect.Kind) any
- func MustConvertToType(from any, toType reflect.Type) any
- func RegisterMapper[From any, To any](mapper Mapper)
- func ReplaceMapper[From any, To any](mapper Mapper)
- func SetField(fieldValue reflect.Value, v any) error
- func SetFieldBySetMethod(fieldValue reflect.Value, v any, fieldStruct reflect.StructField, ...) bool
- func Value2ValueWithOption(from reflect.Value, to reflect.Value, option *MapOption) error
- func WalkField(v any, walkFn WalkFunc) error
- func WalkWithTagNames(v any, tagNames []string, walkFn ParamsWalkFunc[map[string]string]) error
- type Error
- type MapOption
- type Mapper
- type ParamsWalkFunc
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTypeAliasMap ¶
func Clone ¶
func Clone[T any](value *T) *T
Clone is a generic function that creates a new instance of the given type T and assigns the value of the input parameter to the newly created instance. It then returns the pointer to the newly cloned instance.
Parameters: - value: a pointer to the value to be cloned
Returns: - a pointer to a newly created instance of type T, with the same value as the input parameter.
func ConvertToKindWithOption ¶
func ConvertToTypeWithOption ¶
func ConvertToWithOption ¶
func FieldHelper ¶
func FieldHelper(s any) *fieldHelper
func GetFieldPath ¶
func GetFieldPath(structField reflect.StructField, rootValues []reflect.Value) string
func MapToValueWithOption ¶
func MapWithOption ¶
func MustConvertTo ¶
func RegisterMapper ¶
func ReplaceMapper ¶
func SetFieldBySetMethod ¶
func Value2ValueWithOption ¶
func WalkWithTagNames ¶
Types ¶
type Error ¶
type Error struct {
Errors []error
}
Error implements the error interface and can represents multiple errors that occur in the course of a single decode. copy from github.com/mitchellh/mapstructure
func (*Error) WrappedErrors ¶
WrappedErrors implements the errwrap.Wrapper interface to make this return value more useful with the errwrap and go-multierror libraries.
type MapOption ¶
func NewMapOption ¶
func NewMapOption() *MapOption