// NonConvertibleFields iterates over the provided map and filters out all but
// any keys with the "non-convertible.kubernetes.io" prefix.
166975
func NonConvertibleFields(annotations map[string]string) map[string]string {
	nonConvertibleKeys := map[string]string{}
	for key, value := range annotations {
		if strings.HasPrefix(key, core.NonConvertibleAnnotationPrefix) {
			nonConvertibleKeys[key] = value
		}
	}
	return nonConvertibleKeys
}
743784
func removeFields(config, live interface{}) interface{} {
	switch c := config.(type) {
	case map[string]interface{}:
		return RemoveMapFields(c, live.(map[string]interface{}))
	case []interface{}:
		return removeListFields(c, live.([]interface{}))
	default:
		return live
	}
}
154274
func EventToSelectableFields(event *api.Event) fields.Set {
	objectMetaFieldsSet := generic.ObjectMetaFieldsSet(&event.ObjectMeta, true)
	specificFieldsSet := fields.Set{
		"involvedObject.kind":            event.InvolvedObject.Kind,
		"involvedObject.namespace":       event.InvolvedObject.Namespace,
		"involvedObject.name":            event.InvolvedObject.Name,
		"involvedObject.uid":             string(event.InvolvedObject.UID),
		"involvedObject.apiVersion":      event.InvolvedObject.APIVersion,
		"involvedObject.resourceVersion": event.InvolvedObject.ResourceVersion,
		"involvedObject.fieldPath":       event.InvolvedObject.FieldPath,
		"reason":                         event.Reason,
		"source":                         event.Source.Component,
		"type":                           event.Type,
	}
	return generic.MergeFieldsSets(objectMetaFieldsSet, specificFieldsSet)
}
509177
func NestedFieldCopy(obj map[string]interface{}, fields ...string) (interface{}, bool, error) {
	val, found, err := NestedFieldNoCopy(obj, fields...)
	if !found || err != nil {
		return nil, found, err
	}
	return runtime.DeepCopyJSONValue(val), true, nil
}
529142
func ClusterToSelectableFields(obj *kops.Cluster) fields.Set {
	return generic.ObjectMetaFieldsSet(&obj.ObjectMeta, true)
}
1248028
func (s *RedisMapStore) GetFields(key string, fields ...string) (interface{}, error) {
	if !strings.HasPrefix(key, s.prefix) {
		key = s.prefix + key
	}
	result, err := s.client.HMGet(key, fields...).Result()
	if err == redis.Nil {
		return nil, errors.NewErrNotFound(key)
	}
	if err != nil {
		return nil, err
	}
	res := make(map[string]string)
	for i, field := range fields {
		if str, ok := result[i].(string); ok {
			res[field] = str
		}
	}
	i, err := s.decoder(res)
	if err != nil {
		return nil, err
	}
	return i, nil
}
1319824
func (h *handler) ConvertFieldsDown(ctx ttnlog.Interface, appDown *types.DownlinkMessage, ttnDown *pb_broker.DownlinkMessage, _ *device.Device) error {
	if appDown.PayloadFields == nil || len(appDown.PayloadFields) == 0 {
		return nil
	}

	if appDown.PayloadRaw != nil {
		return errors.NewErrInvalidArgument("Downlink", "Both Fields and Payload provided")
	}

	app, err := h.applications.Get(appDown.AppID)
	if err != nil {
		return nil
	}

	var encoder PayloadEncoder
	switch app.PayloadFormat {
	case application.PayloadFormatCustom:
		encoder = &CustomDownlinkFunctions{
			Encoder: app.CustomEncoder,
			Logger:  functions.Ignore,
		}
	case application.PayloadFormatCayenneLPP:
		encoder = &cayennelpp.Encoder{}
	default:
		return nil
	}

	raw, _, err := encoder.Encode(appDown.PayloadFields, appDown.FPort)
	if err != nil {
		return err
	}

	appDown.PayloadRaw = raw

	return nil
}
223751
func HiddenFieldFromInstance(val reflect.Value, t reflect.Type, fieldNo int, name string) *Field {
	ret := HiddenField(name)
	ret.SetValue(fmt.Sprintf("%v", val.Field(fieldNo).Interface()))
	return ret
}
935928
func (s *SearchSource) PartialFields(partialFields ...*PartialField) *SearchSource {
	s.partialFields = append(s.partialFields, partialFields...)
	return s
}
1306772
func ConvertFieldTypeFromModel(t workitem.FieldType) app.FieldType {
	result := app.FieldType{}
	result.Kind = string(t.GetKind())
	switch modelFieldType := t.(type) {
	case workitem.ListType:
		result.ComponentType = ptr.String(string(modelFieldType.ComponentType.GetKind()))
		if modelFieldType.DefaultValue != nil {
			result.DefaultValue = &modelFieldType.DefaultValue
		}
	case workitem.EnumType:
		result.BaseType = ptr.String(string(modelFieldType.BaseType.GetKind()))
		result.Values = modelFieldType.Values
		if modelFieldType.DefaultValue != nil {
			result.DefaultValue = &modelFieldType.DefaultValue
		}
	case workitem.SimpleType:
		if modelFieldType.DefaultValue != nil {
			result.DefaultValue = &modelFieldType.DefaultValue
		}
	}

	return result
}
329415
func (s *UpdateByQueryService) DocvalueFields(docvalueFields ...string) *UpdateByQueryService {
	s.docvalueFields = docvalueFields
	return s
}
1131963
func fieldNameMapping(obj interface{}) map[string]string {
	st := reflect.TypeOf(obj)
	fl := st.NumField()

	jsonToForce := make(map[string]string, fl)

	for i := 0; i < fl; i++ {
		sf := st.Field(i)
		jName := strings.SplitN(sf.Tag.Get("json"), ",", 2)[0]
		fName := strings.SplitN(sf.Tag.Get("force"), ",", 2)[0]

		if jName == "-" {
			continue
		}

		if fName == "-" {
			continue
		}

		if jName == "" {
			jName = sf.Name
		}

		if fName == "" {
			fName = sf.Name
		}

		jsonToForce[jName] = fName
	}

	for k, v := range baseFieldNameMap {
		jsonToForce[k] = v
	}

	return jsonToForce
}
1349873
func newFields() *fields {
	f := new(fields)
	f.fields = make(map[string]*fieldInfo)
	f.fieldsLow = make(map[string]*fieldInfo)
	f.columns = make(map[string]*fieldInfo)
	f.fieldsByType = make(map[int][]*fieldInfo)
	return f
}
1131923
func (obj *Field) GetNxProperties(ctx context.Context) (*NxFieldProperties, error) {
	result := &struct {
		Properties *NxFieldProperties	`json:"qProperties"`
	} {}
	err := obj.rpc(ctx, "GetNxProperties", result)
	return result.Properties, err 
}
577658
func (s *SearchSource) StoredFields(storedFieldNames ...string) *SearchSource {
	s.storedFieldNames = append(s.storedFieldNames, storedFieldNames...)
	return s
}
1025679
func (s FieldSort) IgnoreUnmapped(ignoreUnmapped bool) FieldSort {
	s.ignoreUnmapped = &ignoreUnmapped
	return s
}
991797
func ConvertFieldNames(obj interface{}, jsonFields string) string {
	if jsonFields != "" {
		fields := strings.Split(jsonFields, ",")

		length := len(fields)
		if length > 0 {
			mapping := fieldNameMapping(obj)

			var forceFields []string
			for _, field := range fields {
				if forceField, ok := mapping[field]; ok {
					forceFields = append(forceFields, forceField)
				}
			}

			return strings.Join(forceFields, ",")
		}
	}

	return ""
}