validateAndConvertToInt64 ensures the value is a number and converts it to int64.
(value any)
| 1433 | |
| 1434 | // validateAndConvertToInt64 ensures the value is a number and converts it to int64. |
| 1435 | func validateAndConvertToInt64(value any) (int64, error) { |
| 1436 | switch v := value.(type) { |
| 1437 | case float64: |
| 1438 | // Validate that the float64 can be safely converted to int64 |
| 1439 | intVal := int64(v) |
| 1440 | if float64(intVal) != v { |
| 1441 | return 0, fmt.Errorf("value must be a valid integer (got %v)", v) |
| 1442 | } |
| 1443 | return intVal, nil |
| 1444 | case int64: |
| 1445 | return v, nil |
| 1446 | case int: |
| 1447 | return int64(v), nil |
| 1448 | default: |
| 1449 | return 0, fmt.Errorf("value must be a number (got %T)", v) |
| 1450 | } |
| 1451 | } |
| 1452 | |
| 1453 | // buildUpdateProjectItem constructs UpdateProjectItemOptions from the input map. |
| 1454 | func buildUpdateProjectItem(input map[string]any) (*github.UpdateProjectItemOptions, error) { |
no outgoing calls
no test coverage detected