mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:16:28 +01:00
parent
256cda05fa
commit
cad90a2753
|
@ -173,6 +173,7 @@ func (e Entry) IntDefault(def int) (int, error) {
|
||||||
return int(vv), nil
|
return int(vv), nil
|
||||||
case int64:
|
case int64:
|
||||||
return int(vv), nil
|
return int(vv), nil
|
||||||
|
|
||||||
case uint:
|
case uint:
|
||||||
return int(vv), nil
|
return int(vv), nil
|
||||||
case uint8:
|
case uint8:
|
||||||
|
@ -213,6 +214,17 @@ func (e Entry) Int8Default(def int8) (int8, error) {
|
||||||
return int8(vv), nil
|
return int8(vv), nil
|
||||||
case int64:
|
case int64:
|
||||||
return int8(vv), nil
|
return int8(vv), nil
|
||||||
|
|
||||||
|
case uint:
|
||||||
|
return int8(vv), nil
|
||||||
|
case uint8:
|
||||||
|
return int8(vv), nil
|
||||||
|
case uint16:
|
||||||
|
return int8(vv), nil
|
||||||
|
case uint32:
|
||||||
|
return int8(vv), nil
|
||||||
|
case uint64:
|
||||||
|
return int8(vv), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return def, e.notFound(reflect.Int8)
|
return def, e.notFound(reflect.Int8)
|
||||||
|
@ -243,6 +255,17 @@ func (e Entry) Int16Default(def int16) (int16, error) {
|
||||||
return int16(vv), nil
|
return int16(vv), nil
|
||||||
case int64:
|
case int64:
|
||||||
return int16(vv), nil
|
return int16(vv), nil
|
||||||
|
|
||||||
|
case uint:
|
||||||
|
return int16(vv), nil
|
||||||
|
case uint8:
|
||||||
|
return int16(vv), nil
|
||||||
|
case uint16:
|
||||||
|
return int16(vv), nil
|
||||||
|
case uint32:
|
||||||
|
return int16(vv), nil
|
||||||
|
case uint64:
|
||||||
|
return int16(vv), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return def, e.notFound(reflect.Int16)
|
return def, e.notFound(reflect.Int16)
|
||||||
|
@ -297,6 +320,17 @@ func (e Entry) Int64Default(def int64) (int64, error) {
|
||||||
return int64(vv), nil
|
return int64(vv), nil
|
||||||
case int:
|
case int:
|
||||||
return int64(vv), nil
|
return int64(vv), nil
|
||||||
|
|
||||||
|
case uint:
|
||||||
|
return int64(vv), nil
|
||||||
|
case uint8:
|
||||||
|
return int64(vv), nil
|
||||||
|
case uint16:
|
||||||
|
return int64(vv), nil
|
||||||
|
case uint32:
|
||||||
|
return int64(vv), nil
|
||||||
|
case uint64:
|
||||||
|
return int64(vv), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return def, e.notFound(reflect.Int64)
|
return def, e.notFound(reflect.Int64)
|
||||||
|
@ -344,6 +378,14 @@ func (e Entry) UintDefault(def uint) (uint, error) {
|
||||||
return def, e.notFound(reflect.Uint)
|
return def, e.notFound(reflect.Uint)
|
||||||
}
|
}
|
||||||
return uint(vv), nil
|
return uint(vv), nil
|
||||||
|
case int8:
|
||||||
|
return uint(vv), nil
|
||||||
|
case int16:
|
||||||
|
return uint(vv), nil
|
||||||
|
case int32:
|
||||||
|
return uint(vv), nil
|
||||||
|
case int64:
|
||||||
|
return uint(vv), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return def, e.notFound(reflect.Uint)
|
return def, e.notFound(reflect.Uint)
|
||||||
|
|
|
@ -110,3 +110,12 @@ func TestImmutableSetOnlyWithSetImmutable(t *testing.T) {
|
||||||
t.Fatalf("caller should be able to change the immutable entry with a `SetImmutable`")
|
t.Fatalf("caller should be able to change the immutable entry with a `SetImmutable`")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetInt64Default(t *testing.T) {
|
||||||
|
var p Store
|
||||||
|
|
||||||
|
p.Set("a uint16", uint16(2))
|
||||||
|
if v := p.GetInt64Default("a uint16", 0); v != 2 {
|
||||||
|
t.Fatalf("unexpected value of %d", v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user