We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0672072 commit baf004dCopy full SHA for baf004d
sql/yeartype.go
@@ -111,6 +111,13 @@ func (t yearType) Convert(v interface{}) (interface{}, error) {
111
}
112
return t.Convert(int64(value))
113
case float32:
114
+ if float64(value) < float64(math.MinInt64) || float64(value) > float64(math.MaxInt64) {
115
+ return nil, ErrConvertingToYear.New("float32 value out of bounds for int64")
116
+ }
117
+ // Check for fractional part
118
+ if float64(value) != math.Trunc(float64(value)) {
119
+ return nil, ErrConvertingToYear.New("float32 value has a fractional component, cannot convert to int64")
120
121
122
case float64:
123
if value < float64(math.MinInt16) || value > float64(math.MaxInt16) {
0 commit comments