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

Method GetString

IceFireDB-SQLite/pkg/mysql/mysql/resultset.go:235–258  ·  view source on GitHub ↗
(row, column int)

Source from the content-addressed store, hash-verified

233}
234
235func (r *Resultset) GetString(row, column int) (string, error) {
236 d, err := r.GetValue(row, column)
237 if err != nil {
238 return "", err
239 }
240
241 switch v := d.(type) {
242 case string:
243 return v, nil
244 case []byte:
245 return hack.String(v), nil
246 case int, int8, int16, int32, int64,
247 uint, uint8, uint16, uint32, uint64:
248 return fmt.Sprintf("%d", v), nil
249 case float32:
250 return strconv.FormatFloat(float64(v), 'f', -1, 64), nil
251 case float64:
252 return strconv.FormatFloat(v, 'f', -1, 64), nil
253 case nil:
254 return "", nil
255 default:
256 return "", errors.Errorf("data type is %T", v)
257 }
258}
259
260func (r *Resultset) GetStringByName(row int, name string) (string, error) {
261 if column, err := r.NameIndex(name); err != nil {

Callers 1

GetStringByNameMethod · 0.95

Calls 2

GetValueMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected