// KeyRangeString prints a topodatapb.KeyRange
761059
func KeyRangeString(k *topodatapb.KeyRange) string {
	if k == nil {
		return "-"
	}
	return hex.EncodeToString(k.Start) + "-" + hex.EncodeToString(k.End)
}
924939
func (vdb *VersionedDB) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (statedb.ResultsIterator, error) {
	return vdb.GetStateRangeScanIteratorWithMetadata(namespace, startKey, endKey, nil)
}
891295
func ToStringSigBytesPerKB(n int64, sig, bytesPerKB float64) string {
	var f = float64(n)
	var i int
	for i, _ = range scaleStrings {
		if f < bytesPerKB {
			break
		}
		f = f / bytesPerKB
	}
	f = ToPrecision(f, sig)
	if f == bytesPerKB {
		return strconv.FormatFloat(f/bytesPerKB, 'f', 0, 64) + toCase(scaleStrings[i+1])
	}
	return strconv.FormatFloat(f, 'f', -1, 64) + toCase(scaleStrings[i])
}
1179124
func (ns *Namespace) KeyVals(key interface{}, vals ...interface{}) (types.KeyValues, error) {
	return types.KeyValues{Key: key, Values: vals}, nil
}
681058
func (d DestinationKeyRanges) String() string {
	var buffer bytes.Buffer
	buffer.WriteString("DestinationKeyRanges(")
	for i, kr := range d {
		if i > 0 {
			buffer.WriteByte(',')
		}
		buffer.WriteString(KeyRangeString(kr))
	}
	buffer.WriteByte(')')
	return buffer.String()
}
1347393
func (e *Executor) ParseDestinationTarget(targetString string) (string, topodatapb.TabletType, key.Destination, error) {
	destKeyspace, destTabletType, dest, err := topoproto.ParseDestination(targetString, defaultTabletType)
	// Set default keyspace
	if destKeyspace == "" && len(e.VSchema().Keyspaces) == 1 {
		for k := range e.VSchema().Keyspaces {
			destKeyspace = k
		}
	}
	return destKeyspace, destTabletType, dest, err
}
711773
func (db *BytesConnectionEtcd) ListValuesRange(fromPrefix string, toPrefix string) (keyval.BytesKeyValIterator, error) {
	return listValuesRangeInternal(db.Logger, db.etcdClient, db.opTimeout, fromPrefix, toPrefix)
}
377536
func GetKeyField(keyString string, v reflect.Value) reflect.Value {
	return v.Elem().FieldByName(keyString)
}
825304
func (kvs KeyValues) String() string {
	kvss := []string{}
	for _, kv := range kvs {
		kvss = append(kvss, kv.String())
	}
	return fmt.Sprintf("[%s]", strings.Join(kvss, " / "))
}
389285
func (c *Client) ZRange(key string, start int, stop int, withscores bool) ([]string, error) {
	var v interface{}
	var err error
	if withscores == true {
		v, err = c.execWithKey(true, "ZRANGE", key, start, stop, "WITHSCORES")
	} else {
		v, err = c.execWithKey(true, "ZRANGE", key, start, stop)
	}
	if err != nil {
		return nil, err
	}
	return iface2vstr(v), nil
}
1224258
func (v keyValue) String() string {
	return fmt.Sprintf("%v = '%v'", v.k, v.v)
}
998578
func (a *RequestDataArgs) SetKeyRange(keyRange KeyRange) *RequestDataArgs {
	a.KeyRange = &keyRange
	return a
}
1208393
func (k Key) ChildString(s string) Key {
	return NewKey(k.string + "/" + s)
}
517969
func (m Map) SortedString() string {
	buf := bufPool.Get()
	defer bufPool.Put(buf)
	m.sortedWriteBuf(buf)
	return buf.String()
}
216915
func (qe *UpdateBatchBackedQueryExecuter) GetStateRangeScanIterator(namespace, startKey, endKey string) (statedb.ResultsIterator, error) {
	return qe.UpdateBatch.GetRangeScanIterator(namespace, startKey, endKey), nil
}
229914
func parseClusteringKeys(ckStr string) ([]*ClusteringKey, error) {
	ckStr = strings.TrimSpace(ckStr)
	cks := strings.Split(ckStr, ",")
	var clusteringKeys []*ClusteringKey
	for _, ck := range cks {
		fields := strings.Fields(ck)
		if len(fields) == 0 {
			continue
		}
		if len(fields) > 2 {
			return nil, fmt.Errorf("Clustering key definition %q should look like \"name[ asc/desc]\"",
				ck)
		}
		descending := false
		if len(fields) == 2 {
			switch strings.ToLower(fields[1]) {
			case desc:
				descending = true
			case asc:
				descending = false
			default:
				return nil, fmt.Errorf("invalid clustering key order %q in %q", fields[1], ck)
			}

		}

		clusteringKeys = append(clusteringKeys, &ClusteringKey{Name: strings.TrimSpace(fields[0]), Descending: descending})
	}
	return clusteringKeys, nil
}
1344436
func keyToString(keyEvent *winterm.KEY_EVENT_RECORD, escapeSequence []byte) string {
	if keyEvent.UnicodeChar == 0 {
		return formatVirtualKey(keyEvent.VirtualKeyCode, keyEvent.ControlKeyState, escapeSequence)
	}

	_, alt, control := getControlKeys(keyEvent.ControlKeyState)
	if control {
		// TODO(azlinux): Implement following control sequences
		// <Ctrl>-D  Signals the end of input from the keyboard; also exits current shell.
		// <Ctrl>-H  Deletes the first character to the left of the cursor. Also called the ERASE key.
		// <Ctrl>-Q  Restarts printing after it has been stopped with <Ctrl>-s.
		// <Ctrl>-S  Suspends printing on the screen (does not stop the program).
		// <Ctrl>-U  Deletes all characters on the current line. Also called the KILL key.
		// <Ctrl>-E  Quits current command and creates a core

	}

	// <Alt>+Key generates ESC N Key
	if !control && alt {
		return ansiterm.KEY_ESC_N + strings.ToLower(string(keyEvent.UnicodeChar))
	}

	return string(keyEvent.UnicodeChar)
}