- Interface2DirectIntWithDefault added.
This commit is contained in:
@@ -67,6 +67,13 @@ func Interface2Int64WithDefault(data interface{}, defValue int64) int64 {
|
||||
return MustInterface2Int64(data)
|
||||
}
|
||||
|
||||
func Interface2DirectIntWithDefault(data interface{}, defValue int) int {
|
||||
if data == nil {
|
||||
return defValue
|
||||
}
|
||||
return data.(int)
|
||||
}
|
||||
|
||||
func MustInterface2Float64(data interface{}) float64 {
|
||||
dataNumber, ok := data.(json.Number)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user