mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
- 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.
23 lines
303 B
Go
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
|
|
}
|