MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / GetString

Function GetString

IceFireDB-SQLite/utils/util.go:43–63  ·  view source on GitHub ↗
(d any)

Source from the content-addressed store, hash-verified

41}
42
43func GetString(d any) (string, error) {
44 switch v := d.(type) {
45 case string:
46 return v, nil
47 case []byte:
48 return hack.String(v), nil
49 case int, int8, int16, int32, int64,
50 uint, uint8, uint16, uint32, uint64:
51 return fmt.Sprintf("%d", v), nil
52 case float32:
53 return strconv.FormatFloat(float64(v), 'f', -1, 64), nil
54 case float64:
55 return strconv.FormatFloat(v, 'f', -1, 64), nil
56 case nil:
57 return "", nil
58 case time.Time:
59 return v.String(), nil
60 default:
61 return "", fmt.Errorf("data type is %T", v)
62 }
63}
64
65func IsFileExist(path string) bool {
66 _, err := os.Stat(path)

Callers 1

ExecFunction · 0.92

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected