mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 14:06:36 +08:00
d99c5b7c43
Consolidate pure helper packages under pkg/util and update imports.
17 lines
339 B
Go
17 lines
339 B
Go
package util
|
|
|
|
import "fmt"
|
|
|
|
// Interface2String converts a string, int, or float64 value to its string representation.
|
|
func Interface2String(inter interface{}) string {
|
|
switch v := inter.(type) {
|
|
case string:
|
|
return v
|
|
case int:
|
|
return fmt.Sprintf("%d", v)
|
|
case float64:
|
|
return fmt.Sprintf("%f", v)
|
|
}
|
|
return "Not Implemented"
|
|
}
|