MCPcopy Index your code
hub / github.com/github/github-mcp-server / validateAndConvertToInt64

Function validateAndConvertToInt64

pkg/github/projects.go:1435–1451  ·  view source on GitHub ↗

validateAndConvertToInt64 ensures the value is a number and converts it to int64.

(value any)

Source from the content-addressed store, hash-verified

1433
1434// validateAndConvertToInt64 ensures the value is a number and converts it to int64.
1435func 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.
1454func buildUpdateProjectItem(input map[string]any) (*github.UpdateProjectItemOptions, error) {

Callers 1

buildUpdateProjectItemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected