refactor: structure of api-router directory

This commit is contained in:
0xJacky 2023-11-27 23:53:23 +08:00
parent d272f7900f
commit 50b4fbcda4
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
38 changed files with 610 additions and 524 deletions

View file

@ -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)