主要更新: - 更新 go.mod/go.sum 依赖 - 重新生成 Ent ORM 代码 - 更新 Wire 依赖注入配置 - 添加 docker-compose.override.yml 到 .gitignore - 更新 README 文档(Simple Mode 说明和已知问题) - 清理调试日志 - 其他代码优化和格式修复
25 lines
559 B
Go
25 lines
559 B
Go
package googleapi
|
|
|
|
import "net/http"
|
|
|
|
// HTTPStatusToGoogleStatus maps HTTP status codes to Google-style error status strings.
|
|
func HTTPStatusToGoogleStatus(status int) string {
|
|
switch status {
|
|
case http.StatusBadRequest:
|
|
return "INVALID_ARGUMENT"
|
|
case http.StatusUnauthorized:
|
|
return "UNAUTHENTICATED"
|
|
case http.StatusForbidden:
|
|
return "PERMISSION_DENIED"
|
|
case http.StatusNotFound:
|
|
return "NOT_FOUND"
|
|
case http.StatusTooManyRequests:
|
|
return "RESOURCE_EXHAUSTED"
|
|
default:
|
|
if status >= 500 {
|
|
return "INTERNAL"
|
|
}
|
|
return "UNKNOWN"
|
|
}
|
|
}
|