prototype

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NonPointer               Code = 1
	Nil                           = 2
	Overflow                      = 3
	NegativeNumber                = 4
	FailedParse                   = 5
	PointerCycle                  = 6
	UnsupportedType               = 7
	FailedConvertScanner          = 8
	FailedUnmarshalNew            = 9
	FailedStringify               = 10
	FailedSetEmbeddedPointer      = 11
)

Variables

This section is empty.

Functions

func Clone

func Clone(tgt any, src any, opts ...Option) error

Clone 将值从 src 克隆到 tgt

Types

type Cloner

type Cloner func(labels []string, tgtVal reflect.Value, srcVal reflect.Value) (bool, error)

Cloner is a clone hook.

type ClonerFrom

type ClonerFrom interface {
	CloneFrom(src any) error
}

ClonerFrom 自定义克隆方法,从源克隆到自己

type ClonerTo

type ClonerTo interface {
	CloneTo(tgt any) error
}

ClonerTo 自定义克隆方法,将自己克隆到目标

type Code

type Code int

type Error

type Error struct {
	Code       Code
	Labels     []string
	TargetType reflect.Type
	SourceType reflect.Type
	Value      string
	// contains filtered or unexported fields
}

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type Option

type Option func(o *options)

func Cloners

func Cloners(f ...Cloner) Option

func Context

func Context(ctx context.Context) Option

func DisableDeepClone

func DisableDeepClone() Option

func GetterPrefix

func GetterPrefix(p string) Option

func SetterPrefix

func SetterPrefix(p string) Option

func TagKey

func TagKey(key string) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL