Skip to content

Commit

Permalink
validate once
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincobain2000 committed Jan 26, 2024
1 parent 1483aa5 commit e4d81b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import (
"github.com/labstack/echo/v4"
)

var validate = validator.New()

func ValidateRequest[T any](request T) (map[string]string, error) {
errs := validator.New().Struct(request)
errs := validate.Struct(request)
msgs := make(map[string]string)
if errs != nil {
for _, err := range errs.(validator.ValidationErrors) {
Expand Down

0 comments on commit e4d81b0

Please sign in to comment.