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

Function formatTextValue

IceFireDB-SQLite/pkg/mysql/mysql/resultset_helper.go:11–46  ·  view source on GitHub ↗
(value any)

Source from the content-addressed store, hash-verified

9)
10
11func formatTextValue(value any) ([]byte, error) {
12 switch v := value.(type) {
13 case int8:
14 return strconv.AppendInt(nil, int64(v), 10), nil
15 case int16:
16 return strconv.AppendInt(nil, int64(v), 10), nil
17 case int32:
18 return strconv.AppendInt(nil, int64(v), 10), nil
19 case int64:
20 return strconv.AppendInt(nil, v, 10), nil
21 case int:
22 return strconv.AppendInt(nil, int64(v), 10), nil
23 case uint8:
24 return strconv.AppendUint(nil, uint64(v), 10), nil
25 case uint16:
26 return strconv.AppendUint(nil, uint64(v), 10), nil
27 case uint32:
28 return strconv.AppendUint(nil, uint64(v), 10), nil
29 case uint64:
30 return strconv.AppendUint(nil, v, 10), nil
31 case uint:
32 return strconv.AppendUint(nil, uint64(v), 10), nil
33 case float32:
34 return strconv.AppendFloat(nil, float64(v), 'f', -1, 64), nil
35 case float64:
36 return strconv.AppendFloat(nil, v, 'f', -1, 64), nil
37 case []byte:
38 return v, nil
39 case string:
40 return hack.Slice(v), nil
41 case nil:
42 return nil, nil
43 default:
44 return nil, errors.Errorf("invalid type %T", value)
45 }
46}
47
48func formatBinaryValue(value any) ([]byte, error) {
49 switch v := value.(type) {

Callers 1

BuildSimpleTextResultsetFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected