Documentation ¶
Index ¶
- func All(toObj any, fromObj any) error
- func ErrCopyFromObjectInvalid() error
- func ErrCopyToObjectUnaddressable() error
- func ErrTypeMapNotEqual() error
- func Filter(toObj any, fromObj any, filter FilterFn) error
- func Omit(toObj any, fromObj any, fields ...string) error
- func Select(toObj any, fromObj any, fields ...string) error
- type Cpy
- func (cpy *Cpy) Check(to reflect.Value, from reflect.Value) (isSlice bool, size int, err error)
- func (cpy *Cpy) Copy(toObj any, fromObj any, selected []string, omit []string, filter FilterFn) (err error)
- func (cpy *Cpy) CopyFromField(_ reflect.Type, fromT reflect.Type, dst reflect.Value, src reflect.Value, ...) (err error)
- func (cpy *Cpy) CopyFromMethod(toT reflect.Type, _ reflect.Type, dst reflect.Value, src reflect.Value, ...) (err error)
- func (cpy *Cpy) CopyToIsZero(toRv reflect.Value, fromRv reflect.Value) (err error)
- func (cpy *Cpy) ErrCopyFromObjectInvalid() error
- func (cpy *Cpy) ErrCopyToObjectUnaddressable() error
- func (cpy *Cpy) ErrTypeMapNotEqual() error
- func (cpy *Cpy) FieldReplaceName(field reflect.StructField, name string) (ret string)
- func (cpy *Cpy) Fields(rt reflect.Type) (ret []reflect.StructField)
- func (cpy *Cpy) Indirect(rv reflect.Value) reflect.Value
- func (cpy *Cpy) IndirectType(reflectType reflect.Type) reflect.Type
- func (cpy *Cpy) IsSkip(selected []string, omit []string, srcName string, dstName string) (ret bool)
- func (cpy *Cpy) Set(to reflect.Value, from reflect.Value) (ok bool, err error)
- func (cpy *Cpy) SetToFieldIsZero(toRv reflect.Value, toName string, fromV reflect.Value) (err error)
- func (cpy *Cpy) SetToFieldOrMethod(dst reflect.Value, dstName string, from reflect.Value, _ string, ...) (err error)
- func (cpy *Cpy) SetToIsZero(to reflect.Value, from reflect.Value) (ok bool, err error)
- type FilterFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrCopyFromObjectInvalid ¶
func ErrCopyFromObjectInvalid() error
ErrCopyFromObjectInvalid Error: Copy from object is invalid
func ErrCopyToObjectUnaddressable ¶
func ErrCopyToObjectUnaddressable() error
ErrCopyToObjectUnaddressable Error: Copy to object is unaddressable
func ErrTypeMapNotEqual ¶
func ErrTypeMapNotEqual() error
ErrTypeMapNotEqual Error: Type of map is not equal
Types ¶
type Cpy ¶
type Cpy struct{}
Cpy Объект сущности пакета.
func (*Cpy) Copy ¶
func (cpy *Cpy) Copy(toObj any, fromObj any, selected []string, omit []string, filter FilterFn) (err error)
Copy everything
func (*Cpy) CopyFromField ¶
func (cpy *Cpy) CopyFromField( _ reflect.Type, fromT reflect.Type, dst reflect.Value, src reflect.Value, selected []string, omit []string, filter FilterFn, ) (err error)
CopyFromField Copy from field to field or method
func (*Cpy) CopyFromMethod ¶
func (cpy *Cpy) CopyFromMethod( toT reflect.Type, _ reflect.Type, dst reflect.Value, src reflect.Value, selected []string, omit []string, filter FilterFn, ) (err error)
CopyFromMethod Copy from method to field
func (*Cpy) CopyToIsZero ¶
CopyToIsZero Копирование значений только если значение в объекте назначения пустое.
func (*Cpy) ErrCopyFromObjectInvalid ¶
ErrCopyFromObjectInvalid Error: Copy from object is invalid
func (*Cpy) ErrCopyToObjectUnaddressable ¶
ErrCopyToObjectUnaddressable Error: Copy to object is unaddressable
func (*Cpy) ErrTypeMapNotEqual ¶
ErrTypeMapNotEqual Error: Type of map is not equal
func (*Cpy) FieldReplaceName ¶
func (cpy *Cpy) FieldReplaceName(field reflect.StructField, name string) (ret string)
FieldReplaceName Get field name from tag
func (*Cpy) Fields ¶
func (cpy *Cpy) Fields(rt reflect.Type) (ret []reflect.StructField)
Fields to StructField
func (*Cpy) IndirectType ¶
IndirectType Indirect type get
func (*Cpy) SetToFieldIsZero ¶
func (cpy *Cpy) SetToFieldIsZero(toRv reflect.Value, toName string, fromV reflect.Value) (err error)
SetToFieldIsZero Копирование одного поля по имени, только если значение в объекте назначения пустое.