Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DotUnderscoreHyphenSpace validator.Func = func(fl validator.FieldLevel) bool { field := fl.Field() kind := field.Kind() if kind == reflect.String { s := field.String() isValid := regexp.MustCompile(`^[\sa-zA-Z0-9а-яА-Я_.-]*$`).MatchString noSpaces := !strings.HasPrefix(s, " ") && !strings.HasSuffix(s, " ") return isValid(s) && noSpaces } else { panic(fmt.Sprintf("Bad type for %s", fl.FieldName())) } }
View Source
var ValidateDeviceID validator.Func = func(fl validator.FieldLevel) bool { field := fl.Field() kind := field.Kind() if kind == reflect.Int || kind == reflect.Int64 { deviceID := field.Int() return model.DeviceIDToName(int(deviceID)) != "" } else { panic(fmt.Sprintf("Bad type for %s", fl.FieldName())) } }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.