mirror of
https://github.com/kataras/iris.git
synced 2026-03-06 00:16:12 +00:00
add database/orm/reform example
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package hero
|
||||
|
||||
import (
|
||||
"net"
|
||||
"reflect"
|
||||
|
||||
"github.com/kataras/iris/v12/context"
|
||||
@@ -41,9 +42,12 @@ func isFunc(kindable interface{ Kind() reflect.Kind }) bool {
|
||||
return kindable.Kind() == reflect.Func
|
||||
}
|
||||
|
||||
var inputTyp = reflect.TypeOf((*Input)(nil))
|
||||
var (
|
||||
inputTyp = reflect.TypeOf((*Input)(nil))
|
||||
errTyp = reflect.TypeOf((*error)(nil)).Elem()
|
||||
|
||||
var errTyp = reflect.TypeOf((*error)(nil)).Elem()
|
||||
ipTyp = reflect.TypeOf(net.IP{})
|
||||
)
|
||||
|
||||
// isError returns true if "typ" is type of `error`.
|
||||
func isError(typ reflect.Type) bool {
|
||||
@@ -221,6 +225,10 @@ func isZero(v reflect.Value) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
if v.Type() == ipTyp {
|
||||
return len(v.Interface().(net.IP)) == 0
|
||||
}
|
||||
|
||||
zero := reflect.Zero(v.Type())
|
||||
return v.Interface() == zero.Interface()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user