2018-05-22 18:27:51 +00:00
|
|
|
package main
|
|
|
|
|
2018-05-28 16:25:17 +00:00
|
|
|
import (
|
2018-10-02 09:10:21 +00:00
|
|
|
"git.xdrm.io/go/aicra/driver"
|
2018-05-28 16:25:17 +00:00
|
|
|
"reflect"
|
|
|
|
)
|
|
|
|
|
2018-10-02 09:10:21 +00:00
|
|
|
func main() {}
|
|
|
|
func Export() driver.Checker { return new(StringChecker) }
|
|
|
|
|
|
|
|
type StringChecker int
|
|
|
|
|
|
|
|
func (sck StringChecker) Match(name string) bool {
|
2018-05-22 18:27:51 +00:00
|
|
|
return name == "string"
|
|
|
|
}
|
|
|
|
|
2018-10-02 09:10:21 +00:00
|
|
|
func (sck StringChecker) Check(value interface{}) bool {
|
2018-05-22 18:27:51 +00:00
|
|
|
|
2018-05-31 07:23:30 +00:00
|
|
|
if value == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-05-28 16:25:17 +00:00
|
|
|
kind := reflect.TypeOf(value).Kind()
|
|
|
|
|
|
|
|
return kind == reflect.String
|
|
|
|
|
2018-05-22 18:27:51 +00:00
|
|
|
}
|