MCPcopy Create free account
hub / github.com/apecloud/myduckserver / NormalizeIntsAndFloats

Function NormalizeIntsAndFloats

pgtest/framework.go:323–349  ·  view source on GitHub ↗

NormalizeIntsAndFloats normalizes all int and float types to int64 and float64, respectively.

(v any)

Source from the content-addressed store, hash-verified

321 d := apd.NewWithBigInt(coeff, v.Exp)
322 d.Reduce(d)
323 return d
324}
325
326// NormalizeIntsAndFloats normalizes all int and float types
327// to int64 and float64, respectively.
328func NormalizeIntsAndFloats(v any) any {
329 switch val := v.(type) {
330 case int:
331 return int64(val)
332 case int8:
333 return int64(val)
334 case int16:
335 return int64(val)
336 case int32:
337 return int64(val)
338 case uint:
339 return int64(val)
340 case uint8:
341 return int64(val)
342 case uint16:
343 return int64(val)
344 case uint32:
345 return int64(val)
346 case uint64:
347 // PostgreSQL does not support an uint64 type, so we can always convert this to an int64 safely.
348 return int64(val)
349 // case float32:
350 // return float64(val)
351 default:
352 return val

Callers 2

NormalizeRowFunction · 0.85
NormalizeExpectedRowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected