MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / FmtIntFromInterface

Function FmtIntFromInterface

common/interface_to_all.go:8–37  ·  view source on GitHub ↗
(val interface{})

Source from the content-addressed store, hash-verified

6)
7
8func FmtIntFromInterface(val interface{}) int64 {
9 if val == nil {
10 return 0
11 }
12
13 switch ret := val.(type) {
14 case int8:
15 return int64(ret)
16 case int16:
17 return int64(ret)
18 case int32:
19 return int64(ret)
20 case int64:
21 return ret
22 case uint8:
23 return int64(ret)
24 case uint16:
25 return int64(ret)
26 case uint32:
27 return int64(ret)
28 case uint64:
29 return int64(ret)
30 case int:
31 return int64(ret)
32 case float64:
33 return int64(ret)
34 default:
35 return 0
36 }
37}
38
39func FmtStringFromInterface(val interface{}) string {
40 if val == nil {

Callers 5

summaryMethod · 0.92
CommonStatisticsMethod · 0.92
CommonProxyStatisticsMethod · 0.92
CommonTendencyMethod · 0.92
warnFormatFluxResultsMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected