mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 16:50:18 +01:00
Added encoder/decoder useful in interleved SQLite backend.
This commit is contained in:
parent
b393712801
commit
83c160eb90
@ -140,10 +140,22 @@ func TransformPlainToInterleaved(pos int64) int64 {
|
||||
return CoordToInterleaved(PlainToCoord(pos))
|
||||
}
|
||||
|
||||
func TransformInterleavedPlain(pos int64) int64 {
|
||||
func TransformInterleavedToPlain(pos int64) int64 {
|
||||
return CoordToPlain(InterleavedToCoord(pos))
|
||||
}
|
||||
|
||||
func DecodeStringFromBytesToInterleaved(key []byte) (v int64, err error) {
|
||||
if v, err = DecodeStringFromBytes(key); err != nil {
|
||||
return
|
||||
}
|
||||
v = TransformPlainToInterleaved(v)
|
||||
return
|
||||
}
|
||||
|
||||
func EncodeStringToBytesFromInterleaved(key int64) ([]byte, error) {
|
||||
return EncodeStringToBytes(TransformInterleavedToPlain(key))
|
||||
}
|
||||
|
||||
func SelectKeySplitter(interleaved bool) KeySplitter {
|
||||
if interleaved {
|
||||
return InterleavedToCoord
|
||||
|
Loading…
Reference in New Issue
Block a user