(data any)
| 50 | } |
| 51 | |
| 52 | func Any2Int(data any) int { |
| 53 | if data == nil { |
| 54 | return 0 |
| 55 | } |
| 56 | if valueAssert, ok := data.(float64); ok { |
| 57 | return int(valueAssert) |
| 58 | } |
| 59 | if valueAssert, ok := data.(int64); ok { |
| 60 | return int(valueAssert) |
| 61 | } |
| 62 | if valueAssert, ok := data.(int); ok { |
| 63 | return valueAssert |
| 64 | } |
| 65 | if valueAssert, ok := data.(*int); ok { |
| 66 | return *valueAssert |
| 67 | } |
| 68 | if valueAssert, ok := data.(string); ok { |
| 69 | valueAssertInt, _ := strconv.Atoi(valueAssert) |
| 70 | return valueAssertInt |
| 71 | } |
| 72 | return 0 |
| 73 | } |
| 74 | |
| 75 | func Any2Bool(data any) bool { |
| 76 | if data == nil { |
nothing calls this directly
no outgoing calls
no test coverage detected