Files
crawlab/core/utils/helpers.go
Marvin Zhang c4291e7a93 refactor: update response handling and utility functions
- Changed the summary conversion method in getIDForAction from PascalCase to SnakeCase for consistency with naming conventions.
- Introduced BaseResponse interface and implemented GetData and GetDataString methods for Response, ListResponse, and VoidResponse types, enhancing response handling.
- Simplified the Contains function to specifically handle string slices, improving clarity and maintainability of utility functions.
- Ensured alignment with existing coding standards and added necessary comments for better understanding.
2025-04-07 18:13:49 +08:00

23 lines
303 B
Go

package utils
import (
"github.com/crawlab-team/crawlab/trace"
"io"
)
func Close(c io.Closer) {
err := c.Close()
if err != nil {
trace.PrintError(err)
}
}
func ContainsString(slice []string, item string) bool {
for _, s := range slice {
if s == item {
return true
}
}
return false
}