driver/converter.go
func convertNvInteger(v interface{}, min, max int64) (driver.Value, error) {

	if v == nil {
		return v, nil
	}

	rv := reflect.ValueOf(v)
	switch rv.Kind() {

	// bool is represented in HDB as tinyint
	case reflect.Bool:
		return rv.Bool(), nil
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		i64 := rv.Int()
		if i64 > max || i64 < min {
			return nil, ErrIntegerOutOfRange
		}
		return i64, nil
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		u64 := rv.Uint()
		if u64 > uint64(max) {
			return nil, ErrIntegerOutOfRange
		}
		return int64(u64), nil
	case reflect.Ptr:
		// indirect pointers
		if rv.IsNil() {
			return nil, nil
		}
		return convertNvInteger(rv.Elem().Interface(), min, max)
	}

	return nil, fmt.Errorf("unsupported integer conversion type error %[1]T %[1]v", v)
}
func convertNvInteger(v interface{}, min, max int64) (driver.Value, error) {

	if v == nil {
		return v, nil
	}

	rv := reflect.ValueOf(v)
	switch rv.Kind() {

	// bool is represented in HDB as tinyint
	case reflect.Bool:
		return rv.Bool(), nil
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		i64 := rv.Int()
		if i64 > max || i64 < min {
			return nil, ErrIntegerOutOfRange
		}
		return i64, nil
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		u64 := rv.Uint()
		if u64 > uint64(max) {
			return nil, ErrIntegerOutOfRange
		}
		return int64(u64), nil
	case reflect.Ptr:
		// indirect pointers
		if rv.IsNil() {
			return nil, nil
		}
		return convertNvInteger(rv.Elem().Interface(), min, max)
	}

	return nil, fmt.Errorf("unsupported integer conversion type error %[1]T %[1]v", v)
}
func convertNvInteger ( v interface { } , min , max int64 ) ( driver . Value , error ) { if v == nil { return v , nil } rv := reflect . ValueOf ( v ) switch rv . Kind ( ) { // bool is represented in HDB as tinyint case reflect . Bool : return rv . Bool ( ) , nil case reflect . Int , reflect . Int8 , reflect . Int16 , reflect . Int32 , reflect . Int64 : i64 := rv . Int ( ) if i64 > max || i64 < min { return nil , ErrIntegerOutOfRange } return i64 , nil case reflect . Uint , reflect . Uint8 , reflect . Uint16 , reflect . Uint32 , reflect . Uint64 : u64 := rv . Uint ( ) if u64 > uint64 ( max ) { return nil , ErrIntegerOutOfRange } return int64 ( u64 ) , nil case reflect . Ptr : // indirect pointers if rv . IsNil ( ) { return nil , nil } return convertNvInteger ( rv . Elem ( ) . Interface ( ) , min , max ) } return nil , fmt . Errorf ( " " , v ) }
// integer types
integer types