SetValueAt is an inefficient helper to set the value in a Vec when the type is unknown.
(v *Vec, elem interface{}, rowIdx int)
| 1424 | // SetValueAt is an inefficient helper to set the value in a Vec when the type |
| 1425 | // is unknown. |
| 1426 | func SetValueAt(v *Vec, elem interface{}, rowIdx int) { |
| 1427 | switch t := v.Type(); v.CanonicalTypeFamily() { |
| 1428 | case types.BoolFamily: |
| 1429 | switch t.Width() { |
| 1430 | case -1: |
| 1431 | default: |
| 1432 | target := v.Bool() |
| 1433 | newVal := elem.(bool) |
| 1434 | target.Set(rowIdx, newVal) |
| 1435 | } |
| 1436 | case types.BytesFamily: |
| 1437 | switch t.Width() { |
| 1438 | case -1: |
| 1439 | default: |
| 1440 | target := v.Bytes() |
| 1441 | newVal := elem.([]byte) |
| 1442 | target.Set(rowIdx, newVal) |
| 1443 | } |
| 1444 | case types.DecimalFamily: |
| 1445 | switch t.Width() { |
| 1446 | case -1: |
| 1447 | default: |
| 1448 | target := v.Decimal() |
| 1449 | newVal := elem.(apd.Decimal) |
| 1450 | target.Set(rowIdx, newVal) |
| 1451 | } |
| 1452 | case types.IntFamily: |
| 1453 | switch t.Width() { |
| 1454 | case 16: |
| 1455 | target := v.Int16() |
| 1456 | newVal := elem.(int16) |
| 1457 | target.Set(rowIdx, newVal) |
| 1458 | case 32: |
| 1459 | target := v.Int32() |
| 1460 | newVal := elem.(int32) |
| 1461 | target.Set(rowIdx, newVal) |
| 1462 | case -1: |
| 1463 | default: |
| 1464 | target := v.Int64() |
| 1465 | newVal := elem.(int64) |
| 1466 | target.Set(rowIdx, newVal) |
| 1467 | } |
| 1468 | case types.FloatFamily: |
| 1469 | switch t.Width() { |
| 1470 | case -1: |
| 1471 | default: |
| 1472 | target := v.Float64() |
| 1473 | newVal := elem.(float64) |
| 1474 | target.Set(rowIdx, newVal) |
| 1475 | } |
| 1476 | case types.TimestampTZFamily: |
| 1477 | switch t.Width() { |
| 1478 | case -1: |
| 1479 | default: |
| 1480 | target := v.Timestamp() |
| 1481 | newVal := elem.(time.Time) |
| 1482 | target.Set(rowIdx, newVal) |
| 1483 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…