(val interface{})
| 630 | } |
| 631 | |
| 632 | func toInt64(val interface{}) (int64, error) { |
| 633 | if val == nil { |
| 634 | return 0, nil |
| 635 | } |
| 636 | switch v := val.(type) { |
| 637 | case int64: |
| 638 | return v, nil |
| 639 | case int: |
| 640 | return int64(v), nil |
| 641 | case int32: |
| 642 | return int64(v), nil |
| 643 | case float64: |
| 644 | if v != math.Trunc(v) { |
| 645 | return 0, fmt.Errorf("cannot convert float %f to int64", v) |
| 646 | } |
| 647 | return int64(v), nil |
| 648 | default: |
| 649 | return 0, fmt.Errorf("cannot convert %T to int64", val) |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | func toFloat64(val interface{}) (float64, error) { |
| 654 | if val == nil { |
no outgoing calls
no test coverage detected