MCPcopy Index your code
hub / github.com/apache/devlake / parseFloat

Function parseFloat

backend/plugins/q_dev/tasks/s3_data_extractor.go:252–262  ·  view source on GitHub ↗

parseFloat extracts a float64 from the field map, returning 0 if missing or invalid

(fieldMap map[string]string, field string)

Source from the content-addressed store, hash-verified

250
251// parseFloat extracts a float64 from the field map, returning 0 if missing or invalid
252func parseFloat(fieldMap map[string]string, field string) float64 {
253 value, ok := fieldMap[field]
254 if !ok {
255 return 0
256 }
257 f, err := strconv.ParseFloat(strings.TrimSpace(value), 64)
258 if err != nil {
259 return 0
260 }
261 return f
262}
263
264// parseBool extracts a boolean from the field map, returning false if missing or invalid
265func parseBool(fieldMap map[string]string, field string) bool {

Callers 2

TestParseFloatFunction · 0.85
createUserReportDataFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseFloatFunction · 0.68