Files
ezbookkeeping/pkg/validators/not_blank.go
T
2020-10-17 22:02:50 +08:00

18 lines
279 B
Go

package validators
import (
"strings"
"github.com/go-playground/validator/v10"
)
func NotBlank(fl validator.FieldLevel) bool {
if value, ok := fl.Field().Interface().(string); ok {
if value != "" && strings.Trim(value, " ") != "" {
return true
}
}
return false
}