add 'bool' type checker
This commit is contained in:
parent
12ddf1feae
commit
93aa8b66dc
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"git.xdrm.io/go/aicra/driver"
|
||||
)
|
||||
|
||||
func main() {}
|
||||
func Export() driver.Checker { return new(BoolChecker) }
|
||||
|
||||
type BoolChecker int
|
||||
|
||||
// Match matches the string 'bool'
|
||||
func (bck BoolChecker) Match(name string) bool {
|
||||
return name == "bool"
|
||||
}
|
||||
|
||||
// Check returns true for any type from the @validationTable
|
||||
func (bck BoolChecker) Check(value interface{}) bool {
|
||||
|
||||
// check if bool
|
||||
_, ok := value.(bool)
|
||||
return ok
|
||||
|
||||
}
|
Loading…
Reference in New Issue