mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
refactor: structure of api-router directory
This commit is contained in:
parent
d272f7900f
commit
50b4fbcda4
38 changed files with 610 additions and 524 deletions
|
@ -1,6 +1,7 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/0xJacky/Nginx-UI/internal/logger"
|
||||
"github.com/gin-gonic/gin"
|
||||
val "github.com/go-playground/validator/v10"
|
||||
|
@ -26,7 +27,8 @@ func BindAndValid(c *gin.Context, target interface{}) bool {
|
|||
if err != nil {
|
||||
logger.Error("bind err", err)
|
||||
|
||||
verrs, ok := err.(val.ValidationErrors)
|
||||
var verrs val.ValidationErrors
|
||||
ok := errors.As(err, &verrs)
|
||||
|
||||
if !ok {
|
||||
logger.Error("valid err", verrs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue