Пример #1
0
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)
}
Пример #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
}