feat(recursive-move): Advanced conflict policy for preventing unintentional overwriting (#7906)
This commit is contained in:
@ -68,21 +68,29 @@ func ErrorStrResp(c *gin.Context, str string, code int, l ...bool) {
|
||||
}
|
||||
|
||||
func SuccessResp(c *gin.Context, data ...interface{}) {
|
||||
if len(data) == 0 {
|
||||
c.JSON(200, Resp[interface{}]{
|
||||
Code: 200,
|
||||
Message: "success",
|
||||
Data: nil,
|
||||
})
|
||||
return
|
||||
SuccessWithMsgResp(c, "success", data...)
|
||||
}
|
||||
|
||||
func SuccessWithMsgResp(c *gin.Context, msg string, data ...interface{}) {
|
||||
var respData interface{}
|
||||
if len(data) > 0 {
|
||||
respData = data[0]
|
||||
}
|
||||
|
||||
c.JSON(200, Resp[interface{}]{
|
||||
Code: 200,
|
||||
Message: "success",
|
||||
Data: data[0],
|
||||
Message: msg,
|
||||
Data: respData,
|
||||
})
|
||||
}
|
||||
|
||||
func Pluralize(count int, singular, plural string) string {
|
||||
if count == 1 {
|
||||
return singular
|
||||
}
|
||||
return plural
|
||||
}
|
||||
|
||||
func GetHttpReq(ctx context.Context) *http.Request {
|
||||
if c, ok := ctx.(*gin.Context); ok {
|
||||
return c.Request
|
||||
|
Reference in New Issue
Block a user