(row, column int)
| 233 | } |
| 234 | |
| 235 | func (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 | |
| 260 | func (r *Resultset) GetStringByName(row int, name string) (string, error) { |
| 261 | if column, err := r.NameIndex(name); err != nil { |
no test coverage detected