19 lines
365 B
Go
19 lines
365 B
Go
package validators
|
|
|
|
import (
|
|
"github.com/go-playground/validator/v10"
|
|
|
|
"github.com/mayswind/ezbookkeeping/pkg/utils"
|
|
)
|
|
|
|
// ValidNickname returns whether the given nick name is valid
|
|
func ValidNickname(fl validator.FieldLevel) bool {
|
|
if value, ok := fl.Field().Interface().(string); ok {
|
|
if utils.IsValidNickName(value) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|