mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00: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))
|
return CoordToInterleaved(PlainToCoord(pos))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TransformInterleavedPlain(pos int64) int64 {
|
func TransformInterleavedToPlain(pos int64) int64 {
|
||||||
return CoordToPlain(InterleavedToCoord(pos))
|
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 {
|
func SelectKeySplitter(interleaved bool) KeySplitter {
|
||||||
if interleaved {
|
if interleaved {
|
||||||
return InterleavedToCoord
|
return InterleavedToCoord
|
||||||
|
Loading…
Reference in New Issue
Block a user