17 lines
376 B
Go
17 lines
376 B
Go
package reflection
|
|
|
|
import "git.nspix.com/golang/kos/util/reflect"
|
|
|
|
func Setter[T string | int | int64 | float64 | any](hacky any, variables map[string]T) (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 any) (err error) {
|
|
return reflect.Set(hacky, field, value)
|
|
}
|