MCPcopy
hub / github.com/yusing/godoxy / initPtr

Function initPtr

internal/serialization/serialization.go:102–109  ·  view source on GitHub ↗

initPtr initialize the ptr with default value if exists, otherwise, initialize the ptr with zero value.

(dst reflect.Value)

Source from the content-addressed store, hash-verified

100// initPtr initialize the ptr with default value if exists,
101// otherwise, initialize the ptr with zero value.
102func initPtr(dst reflect.Value) {
103 dstT := dst.Type()
104 if dv, ok := defaultValues[dstT.Elem()]; ok {
105 dst.Set(reflect.ValueOf(dv()))
106 } else {
107 gi.ReflectInitPtr(dst)
108 }
109}
110
111// ValidateWithFieldTags performs struct validation using go-playground/validator tags.
112//

Callers 4

ConvertFunction · 0.85
ConvertSliceFunction · 0.85
ConvertStringFunction · 0.85

Calls 2

TypeMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected