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

Function FmtStringFromInterface

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

Source from the content-addressed store, hash-verified

37}
38
39func FmtStringFromInterface(val interface{}) string {
40 if val == nil {
41 return ""
42 }
43 switch ret := val.(type) {
44 case string:
45 return ret
46 case int8, uint8, int16, uint16, int, uint, int64, uint64, float32, float64:
47 return fmt.Sprintf("%v", ret)
48 }
49 return ""
50}
51
52func FmtFloatFromInterface(val interface{}) float64 {
53 if val == nil {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected