You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: field_reader.go
    path of file: ./repos/terraform/internal/legacy/helper/schema
    
    the code of the file until where you have to start completion: // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

package schema

import (
	"fmt"
	"strconv"
	"strings"
)

// FieldReaders are responsible for decoding fields out of data into
// the proper typed representation. ResourceData uses this to query data
// out of multiple sources
    
func mapValuesToPrimitive(k string, m map[string]interface{}, schema *Schema) error {
	elemType, err := getValueType(k, schema)
	if err != nil {
		return err
	}

	switch elemType {
	case TypeInt, TypeFloat, TypeBool:
		for k, v := range m {
			vs, ok := v.(string)
			if !ok {
				continue
			}

			v, err := stringToPrimitive(vs, false, &Schema{Type: elemType})
			if err != nil {
				return err
			}

			m[k] = v
		}
	}
	return nil
}