Kv encodes integer as double
Anyone know why Deno.kv encodes an integer in a mutli-part key as a double?
the - 33, 192, 8 above represents a Double
(code 33 = Double) with value 3
It should encode to:
21, 3 represents (code 21 = integer) 3
6 Replies
doubles are a safe way to represent JS numbers
I assume that's about as deep as the reasoning goes
It's very inefficient. The lib I've ported handles integers without issue. Also the rust codec seems to handle integers, but my testing shows that it is not working.
could you share the rest of the code in the match?
I don't think this is a bug
Thanks for looking!
I'll have to modify my FDB-codec to match this odd behaviour. I'm building a KV utility that will display the raw k: blob and v: blob from the SQLite
kv
table.
I re-read the docs. Looks like the only 'int' supported is Bigint, 1n.
I'll modify my lib to match.
Thanks again. 😊
Yes changing the key to 3n does allow encoding to integer.
This returns [21, 3] where (code 21 = integer, and 3 is the value)
For a large data sets, this saves 7 bytes per key.good to know