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

Method GetFloat

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

Source from the content-addressed store, hash-verified

183}
184
185func (r *Resultset) GetFloat(row, column int) (float64, error) {
186 d, err := r.GetValue(row, column)
187 if err != nil {
188 return 0, err
189 }
190
191 switch v := d.(type) {
192 case int:
193 return float64(v), nil
194 case int8:
195 return float64(v), nil
196 case int16:
197 return float64(v), nil
198 case int32:
199 return float64(v), nil
200 case int64:
201 return float64(v), nil
202 case uint:
203 return float64(v), nil
204 case uint8:
205 return float64(v), nil
206 case uint16:
207 return float64(v), nil
208 case uint32:
209 return float64(v), nil
210 case uint64:
211 return float64(v), nil
212 case float32:
213 return float64(v), nil
214 case float64:
215 return v, nil
216 case string:
217 return strconv.ParseFloat(v, 64)
218 case []byte:
219 return strconv.ParseFloat(string(v), 64)
220 case nil:
221 return 0, nil
222 default:
223 return 0, errors.Errorf("data type is %T", v)
224 }
225}
226
227func (r *Resultset) GetFloatByName(row int, name string) (float64, error) {
228 if column, err := r.NameIndex(name); err != nil {

Callers 1

GetFloatByNameMethod · 0.95

Calls 1

GetValueMethod · 0.95

Tested by

no test coverage detected