kos/util/reflection/reflection.go

17 lines
346 B
Go
Raw Permalink Normal View History

2023-06-30 14:16:16 +08:00
package reflection
import "git.nspix.com/golang/kos/util/reflect"
func Setter(hacky any, variables map[string]any) (err error) {
for k, v := range variables {
if err = Set(hacky, k, v); err != nil {
return err
}
}
return
}
func Set(hacky any, field string, value interface{}) (err error) {
return reflect.Set(hacky, field, value)
}