From 12ddf1feaeb5220a5c7d69955e9c1897e8098efa Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 2 Oct 2018 11:55:47 +0200 Subject: [PATCH] add 'float' type checker --- internal/checker/default/float/main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 internal/checker/default/float/main.go diff --git a/internal/checker/default/float/main.go b/internal/checker/default/float/main.go new file mode 100644 index 0000000..3b272e8 --- /dev/null +++ b/internal/checker/default/float/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "git.xdrm.io/go/aicra/driver" +) + +func main() {} +func Export() driver.Checker { return new(FloatChecker) } + +type FloatChecker int + +// Match matches the string 'int' +func (fck FloatChecker) Match(name string) bool { + return name == "float" +} + +// Check returns true for any type from the @validationTable +func (fck FloatChecker) Check(value interface{}) bool { + + // check if float (default wrapping type) + _, ok := value.(float64) + return ok + +}