EncodeHandleInUniqueIndexValue encodes handle in data.
(h kv.Handle, isUntouched bool)
| 1805 | |
| 1806 | // EncodeHandleInUniqueIndexValue encodes handle in data. |
| 1807 | func EncodeHandleInUniqueIndexValue(h kv.Handle, isUntouched bool) []byte { |
| 1808 | if h.IsInt() { |
| 1809 | var data [8]byte |
| 1810 | binary.BigEndian.PutUint64(data[:], uint64(h.IntValue())) |
| 1811 | return data[:] |
| 1812 | } |
| 1813 | var untouchedFlag byte |
| 1814 | if isUntouched { |
| 1815 | untouchedFlag = 1 |
| 1816 | } |
| 1817 | return encodeCommonHandle([]byte{untouchedFlag}, h) |
| 1818 | } |
| 1819 | |
| 1820 | func encodeCommonHandle(idxVal []byte, h kv.Handle) []byte { |
| 1821 | idxVal = append(idxVal, CommonHandleFlag) |