added team view to season_leagues
This commit is contained in:
24
internal/validation/boolfield.go
Normal file
24
internal/validation/boolfield.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package validation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type BoolField struct {
|
||||
FieldBase
|
||||
Value bool
|
||||
}
|
||||
|
||||
func newBoolField(key string, g Getter) *BoolField {
|
||||
raw := g.Get(key)
|
||||
val, err := strconv.ParseBool(raw)
|
||||
if err != nil {
|
||||
g.AddCheck(newFailedCheck("Invalid boolean value",
|
||||
fmt.Sprintf("Field %s requires a boolean value, %s given", key, raw)))
|
||||
}
|
||||
return &BoolField{
|
||||
newField(key, g),
|
||||
val,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user