From 4ba50e5df52c2b850a463d859542ec81808190db Mon Sep 17 00:00:00 2001 From: astaxie Date: Mon, 12 Oct 2015 20:50:58 +0800 Subject: [PATCH] fix #1385 --- validation/validators.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/validation/validators.go b/validation/validators.go index ec1545fb..2662b701 100644 --- a/validation/validators.go +++ b/validation/validators.go @@ -74,6 +74,33 @@ func (r Required) IsSatisfied(obj interface{}) bool { if i, ok := obj.(int); ok { return i != 0 } + if i, ok := obj.(uint); ok { + return i != 0 + } + if i, ok := obj.(int8); ok { + return i != 0 + } + if i, ok := obj.(uint8); ok { + return i != 0 + } + if i, ok := obj.(int16); ok { + return i != 0 + } + if i, ok := obj.(uint16); ok { + return i != 0 + } + if i, ok := obj.(uint32); ok { + return i != 0 + } + if i, ok := obj.(int32); ok { + return i != 0 + } + if i, ok := obj.(int64); ok { + return i != 0 + } + if i, ok := obj.(uint64); ok { + return i != 0 + } if t, ok := obj.(time.Time); ok { return !t.IsZero() }