func EncodeOrderPreservingVarUint64(number uint64) []byte {
	bytes := make([]byte, 8)
	binary.BigEndian.PutUint64(bytes, number)
	startingIndex := 0
	size := 0
	for i, b := range bytes {
		if b != 0x00 {
			startingIndex = i
			size = 8 - i
			break
		}
	}
	sizeBytes := proto.EncodeVarint(uint64(size))
	if len(sizeBytes) > 1 {
		panic(fmt.Errorf("[]sizeBytes should not be more than one byte because the max number it needs to hold is 8. size=%d", size))
	}
	encodedBytes := make([]byte, size+1)
	encodedBytes[0] = sizeBytes[0]
	copy(encodedBytes[1:], bytes[startingIndex:])
	return encodedBytes
}
// EncodeOrderPreservingVarUint64 returns a byte-representation for a uint64 number such that
// all zero-bits starting bytes are trimmed in order to reduce the length of the array
// For preserving the order in a default bytes-comparision, first byte contains the number of remaining bytes.
// The presence of first byte also allows to use the returned bytes as part of other larger byte array such as a
// composite-key representation in db
EncodeOrderPreservingVarUint64 returns a byte-representation for a uint64 number such that
all zero-bits starting bytes are trimmed in order to reduce the length of the array
For preserving the order in a default bytes-comparision, first byte contains the number of remaining bytes.
The presence of first byte also allows to use the returned bytes as part of other larger byte array such as a
composite-key representation in db
// EncodeOrderPreservingVarUint64 returns a byte - representation for a uint64 number such that // all zero - bits starting bytes are trimmed in order to reduce the length of the array // For preserving the order in a default bytes - comparision first byte contains the number of remaining bytes . // The presence of first byte also allows to use the returned bytes as part of other larger byte array such as a // composite - key representation in db
func EncodeOrderPreservingVarUint64(number uint64) []byte {
	bytes := make([]byte, 8)
	binary.BigEndian.PutUint64(bytes, number)
	startingIndex := 0
	size := 0
	for i, b := range bytes {
		if b != 0x00 {
			startingIndex = i
			size = 8 - i
			break
		}
	}
	sizeBytes := proto.EncodeVarint(uint64(size))
	if len(sizeBytes) > 1 {
		panic(fmt.Errorf("[]sizeBytes should not be more than one byte because the max number it needs to hold is 8. size=%d", size))
	}
	encodedBytes := make([]byte, size+1)
	encodedBytes[0] = sizeBytes[0]
	copy(encodedBytes[1:], bytes[startingIndex:])
	return encodedBytes
}
func EncodeOrderPreservingVarUint64 ( number uint64 ) [ ] byte { bytes := make ( [ ] byte , 8 ) binary . BigEndian . PutUint64 ( bytes , number ) startingIndex := 0 size := 0 for i , b := range bytes { if b != 0x00 { startingIndex = i size = 8 - i break } } sizeBytes := proto . EncodeVarint ( uint64 ( size ) ) if len ( sizeBytes ) > 1 { panic ( fmt . Errorf ( " " , size ) ) } encodedBytes := make ( [ ] byte , size + 1 ) encodedBytes [ 0 ] = sizeBytes [ 0 ] copy ( encodedBytes [ 1 : ] , bytes [ startingIndex : ] ) return encodedBytes }
EncodeOrderPreservingVarUint64 returns a byte-representation for a uint64 number such that
all zero-bits starting bytes are trimmed in order to reduce the length of the array
For preserving the order in a default bytes-comparision, first byte contains the number of remaining bytes.
EncodeOrderPreservingVarUint64 returns a byte - representation for a uint64 number such that all zero - bits starting bytes are trimmed in order to reduce the length of the array For preserving the order in a default bytes - comparision first byte contains the number of remaining bytes .