removed resolved todos
This commit is contained in:
parent
2e031a9763
commit
a64ce2feb1
3 changed files with 22 additions and 40 deletions
|
@ -4,7 +4,6 @@
|
|||
package validation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"regexp"
|
||||
|
@ -135,23 +134,3 @@ func IsValidUsername(name string) bool {
|
|||
|
||||
return validUsernamePatternWithoutDots.MatchString(name) && !invalidUsernamePattern.MatchString(name)
|
||||
}
|
||||
|
||||
func ValidateNotEmpty(value string, fieldName string) []string {
|
||||
if value == "" {
|
||||
return []string{fmt.Sprintf("Field %v may not be empty", fieldName)}
|
||||
}
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func ValidateOneOf(value string, allowed []string) []string {
|
||||
for _, allowedElem := range allowed {
|
||||
if value == allowedElem {
|
||||
return []string{}
|
||||
}
|
||||
}
|
||||
return []string{fmt.Sprintf("Value %v is not contained in allowed values [%v]", value, allowed)}
|
||||
}
|
||||
|
||||
func ValidateSuffix(str, suffix string) bool {
|
||||
return strings.HasSuffix(str, suffix)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue