1
0
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:
Gerasimos (Makis) Maropoulos
2020-08-01 03:46:51 +03:00
parent eacbcea653
commit acf058b006
10 changed files with 339 additions and 2 deletions

View File

@@ -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()
}