Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Anything = generic.DefineFunc("CopyAnything(err *error, dst DT, src ST)"). Param("DT", "the dst type to copy into"). Param("ST", "the src type to copy from"). Generators( "dispatch", dispatch, "hasErrorField", func(typ reflect.Type) bool { if typ.Kind() != reflect.Ptr { return false } typ = typ.Elem() if typ.Kind() != reflect.Struct { return false } _, found := typ.FieldByName("Error") return found }). ImportPackage("io"). Declare("var ioEOF = io.EOF"). Source(` {{ $tmpl := dispatch .DT .ST }} {{ $cp := expand $tmpl "DT" .DT "ST" .ST }} {{$cp}}(err, dst, src) {{ if hasErrorField .ST }} if src.Error != nil && src.Error != ioEOF { *err = src.Error } {{ end }} {{ if hasErrorField .DT }} if dst.Error != nil { *err = dst.Error } {{ end }} `)
View Source
var AnythingForPlz = generic.DefineFunc("CopyAnythingForPlz(theCopyDynamically CT, dst interface{}, src interface{}) error"). Param("DT", "the dst type to copy into"). Param("ST", "the src type to copy from"). Param("CT", "type of copy dynamically function"). ImportFunc(Anything). Declare("var copyDynamically func(interface{}, interface{}) error"). Source(` {{ $cp := expand "CopyAnything" "DT" .DT "ST" .ST }} copyDynamically = theCopyDynamically var err error {{$cp}}(&err, dst.({{.DT|name}}), src.({{.ST|name}})) return err`)
View Source
var Dispatchers = []func(dstType, srcType reflect.Type) string{}
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.