func()

in grok.go [277:304]


func (grok *Grok) convertMatch(match, name string) (interface{}, error) {
	hint, found := grok.typeHints[name]
	if !found {
		return match, nil
	}

	switch hint {
	case "string":
		return match, nil

	case "double":
		return strconv.ParseFloat(match, 64)
	case "float":
		return strconv.ParseFloat(match, 64)

	case "int":
		return strconv.Atoi(match)
	case "long":
		return strconv.Atoi(match)

	case "bool":
		return strconv.ParseBool(match)
	case "boolean":
		return strconv.ParseBool(match)
	default:
		return nil, fmt.Errorf("invalid type for %v: %w", name, ErrTypeNotProvided)
	}
}