MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / interfaceToString

Function interfaceToString

structure/types.go:52–69  ·  view source on GitHub ↗
(value interface{})

Source from the content-addressed store, hash-verified

50}
51
52func interfaceToString(value interface{}) (string, error) {
53 switch value := value.(type) {
54 case string:
55 return value, nil
56 case int:
57 return strconv.Itoa(value), nil
58 case int64:
59 return strconv.FormatInt(value, 10), nil
60 case float64:
61 return strconv.FormatFloat(value, 'f', -1, 64), nil
62 case bool:
63 return strconv.FormatBool(value), nil
64 case []byte:
65 return string(value), nil
66 default:
67 return "", errors.New("unsupported type")
68 }
69}
70
71//func byteToInterface(value []byte, dataType string) (interface{}, error) {
72// switch dataType {

Callers 3

SizeMethod · 0.85
SizeMethod · 0.85
SizeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected