Esempio n. 1
0
File: set.go Progetto: baobabus/gcfg
func scanSetter(d interface{}, blank bool, val string, t metadata) error {
	if blank {
		return errBlankUnsupported
	}
	if err := types.ScanFully(d, val, 'v'); err != nil {
		return err
	}
	return checkConstraints(d, t, scanBoundary)
}
Esempio n. 2
0
// Gets boundary value by scanning
func scanBoundary(d interface{}, val string) (*reflect.Value, error) {
	if val == "" {
		return nil, nil
	}
	v := reflect.New(reflect.ValueOf(d).Elem().Type())
	r := &v
	if err := types.ScanFully(r.Interface(), val, 'v'); err != nil {
		return nil, err
	}
	return r, nil
}