// CloneWithFieldsOf will return a copy of the current values
// plus the "s" struct's fields that are filled(non-zero) by the caller.
356139
func (bv Values) CloneWithFieldsOf(s interface{}) Values {
	values := bv.Clone()

	// add the manual filled fields to the dependencies.
	filledFieldValues := LookupNonZeroFieldsValues(ValueOf(s), true)
	values = append(values, filledFieldValues...)
	return values
}
240765
func (ff *firstRowFunction) Clone() AggregationFunction {
	nf := *ff
	for i, arg := range ff.Args {
		nf.Args[i] = arg.Clone()
	}
	nf.resultMapper = make(aggCtxMapper)
	return &nf
}
367092
func (builder *SearchCommandBuilder) WithSortField(sortField string) *SearchCommandBuilder {
	builder.protobuf.Sort = []byte(sortField)
	return builder
}
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
}
544456
func WithField(ctx context.Context, key, value string) context.Context {
	return WithFields(ctx, logrus.Fields{key: value})
}
940850
func Fields(obj interface{}) ([]reflect.StructField, error) {
	if !hasValidType(obj, []reflect.Kind{reflect.Struct, reflect.Ptr}) {
		return nil, errors.New("Cannot use GetField on a non-struct interface")
	}

	objValue := reflectValue(obj)
	objType := objValue.Type()
	fieldsCount := objType.NumField()

	var fields []reflect.StructField
	for i := 0; i < fieldsCount; i++ {
		field := objType.Field(i)
		if !isExportableField(field) {
			continue
		}

		fields = append(fields, field)
		if k := objValue.Field(i).Kind(); k == reflect.Struct || k == reflect.Ptr {
			nestedFields, _ := Fields(objValue.Field(i).Interface())
			fields = append(fields, nestedFields...)
		}
	}

	return fields, nil
}
164044
func (sf *ScalarFunction) Clone() Expression {
	return &ScalarFunction{
		FuncName: sf.FuncName,
		RetType:  sf.RetType,
		Function: sf.Function.Clone(),
		hashcode: sf.hashcode,
	}
}
253940
func (bv Values) Clone() Values {
	if n := len(bv); n > 0 {
		values := make(Values, n, n)
		copy(values, bv)
		return values
	}

	return NewValues()
}
651833
func (h Headers) Clone() Headers {
	r := make(Headers, len(h))
	copy(r, h)
	return r
}
1153761
func (fs *FilteringSource) Clone() Source {
	return &FilteringSource{
		Source: fs.Source.Clone(),
		Filter: fs.Filter,
	}
}
626605
func DeriveFromFields(format string, fields ...string) FieldFormatterFunc {
	return func(input interface{}, _ FieldOperation) (interface{}, error) {
		if record, ok := input.(*Record); ok {
			values := make([]interface{}, len(fields))

			for i, field := range fields {
				values[i] = record.Get(field)
			}

			return fmt.Sprintf(format, values...), nil
		} else {
			return nil, fmt.Errorf("DeriveFromFields formatter requires a *dal.Record argument, got %T", input)
		}
	}
}
325933
func StringFieldWithKey(target interface{}, key string) string {
	item, err := fieldWithKey(target, key)
	if err != nil {
		return ""
	}

	field := reflect.ValueOf(target).Elem().FieldByName(item)

	if field.Kind() == reflect.String {
		ptr := field.Addr().Interface().(*string)

		return string(*ptr)
	}

	return ""
}
1284117
func cloneAttrs(m map[string]interface{}) map[string]interface{} {
	other := make(map[string]interface{}, len(m))
	for k, v := range m {
		other[k] = v
	}
	return other
}
428506
func (mmap MarshalMap) Clone() MarshalMap {
	clone := cloneMap(reflect.ValueOf(mmap))
	return clone.Interface().(MarshalMap)
}
193661
func (s *ServiceState) Clone() *ServiceState {
	s2 := new(ServiceState)
	*s2 = *s
	return s2
}
110177
func (c *Constant) Clone() Expression {
	if c.DeferredExpr != nil {
		con := *c
		return &con
	}
	return c
}
578008
func (s *shim) WithFields(fields log.Fields) log.Logger {
	var keyvals []interface{}

	for key, value := range fields {
		keyvals = append(keyvals, key, value)
	}

	return &shim{
		logger: kitlog.With(s.logger, keyvals...),
	}
}