add a helper function (#443)

This commit is contained in:
UUBulb
2024-10-21 12:11:02 +08:00
committed by GitHub
parent aa20c97312
commit cf5408751e
4 changed files with 21 additions and 6 deletions

View File

@@ -27,7 +27,7 @@ func listServerGroup(c *gin.Context) {
c.JSON(http.StatusOK, model.CommonResponse[[]model.ServerGroup]{
Success: err == nil,
Data: sg,
Error: utils.IfOrFn[string](err == nil, func() string {
Error: utils.IfOrFn(err == nil, func() string {
return err.Error()
}, func() string {
return ""