#3 Feature/pass bind function as parse param

已關閉
Wendell 請求將 1 次程式碼提交從 feature/bind-func-as-param 合併至 master
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. 2
    2
      request/request.go

+ 2
- 2
request/request.go 查看文件

@@ -12,9 +12,9 @@ type Checker interface {
12 12
 	Check() error
13 13
 }
14 14
 
15
-func ParseSuccess(ctx *gin.Context, r interface{}, fs ...func() error) bool {
15
+func ParseSuccess(ctx *gin.Context, r interface{}, bindFunc func(*gin.Context, interface{}) error, fs ...func() error) bool {
16 16
 	if r != nil {
17
-		if Fail(ctx, http.StatusBadRequest, ctx.ShouldBind(r)) {
17
+		if Fail(ctx, http.StatusBadRequest, bindFunc(ctx, r)) {
18 18
 			return false
19 19
 		}
20 20