This commit is contained in:
parent
c726c66758
commit
6ecdd575aa
5
map.go
5
map.go
@ -78,7 +78,12 @@ func (this Map) GetCeilInt(key string, err ...*Error) int {
|
||||
return v
|
||||
|
||||
}
|
||||
//获取向上取整float64
|
||||
func (this Map) GetCeilFloat64(key string, err ...*Error) float64 {
|
||||
v := ObjToCeilFloat64((this)[key], err...)
|
||||
return v
|
||||
|
||||
}
|
||||
//获取Float64
|
||||
func (this Map) GetFloat64(key string, err ...*Error) float64 {
|
||||
|
||||
|
16
obj.go
16
obj.go
@ -31,6 +31,16 @@ func (this *Obj) ToFloat64(err ...Error) float64 {
|
||||
return ObjToFloat64(this.Data, &this.Error)
|
||||
}
|
||||
|
||||
//获取向上取整float64
|
||||
func (this *Obj) ToCeilFloat64(err ...*Error) float64 {
|
||||
if len(err) != 0 {
|
||||
this.Error = *err[0]
|
||||
}
|
||||
v := ObjToCeilFloat64(this.Data, err...)
|
||||
return v
|
||||
|
||||
}
|
||||
|
||||
func (this *Obj) ToStr() string {
|
||||
|
||||
return ObjToStr(this.Data)
|
||||
@ -57,12 +67,18 @@ func (this *Obj) ToObj() interface{} {
|
||||
|
||||
//获取向上取整Int64
|
||||
func (this *Obj) ToCeilInt64(err ...*Error) int64 {
|
||||
if len(err) != 0 {
|
||||
this.Error = *err[0]
|
||||
}
|
||||
v := ObjToCeilInt64(this.Data, err...)
|
||||
return v
|
||||
|
||||
}
|
||||
//获取向上取整Int
|
||||
func (this *Obj) ToCeilInt(err ...*Error) int {
|
||||
if len(err) != 0 {
|
||||
this.Error = *err[0]
|
||||
}
|
||||
v := ObjToCeilInt(this.Data, err...)
|
||||
return v
|
||||
|
||||
|
16
objtoobj.go
16
objtoobj.go
@ -134,14 +134,22 @@ func ObjToFloat64(obj interface{}, e ...*Error) float64 {
|
||||
}
|
||||
//向上取整
|
||||
func ObjToCeilInt64(obj interface{}, e ...*Error)int64{
|
||||
f:=ObjToFloat64(obj,e...)
|
||||
return ObjToInt64(math.Ceil(f))
|
||||
f:=ObjToCeilFloat64(obj,e...)
|
||||
return ObjToInt64(math.Ceil(f))
|
||||
|
||||
}
|
||||
|
||||
//向上取整
|
||||
func ObjToCeilFloat64(obj interface{}, e ...*Error)float64{
|
||||
f:=ObjToFloat64(obj,e...)
|
||||
return math.Ceil(f)
|
||||
|
||||
}
|
||||
|
||||
//向上取整
|
||||
func ObjToCeilInt(obj interface{}, e ...*Error)int{
|
||||
f:=ObjToFloat64(obj,e...)
|
||||
return ObjToInt(math.Ceil(f))
|
||||
f:=ObjToCeilFloat64(obj,e...)
|
||||
return ObjToInt(f)
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user