Open javierfjc opened 1 year ago
"The supported integer values include all integers between -2^53 and 2^53, and some integers with larger magnitude" - https://docs.hivedb.dev/#/more/limitations is all I can find on this. It probably has something to do with the limits of integer and double types across all programming languages. A good explanation I found is in the Safe Integers section of this page: https://exploringjs.com/es5/ch11.html
In file frame.dart there is a control about key valid. The key can be integer between 0 and 0xFFFFFFFF. Why the top limit ? I have custom keys that are integers but highest than 0xFFFFFFFF.
myBox.put(500000000581, ItemObject); -> thrown Exception Integer keys need to be in the range 0 - 0xFFFFFFFF
frame.dart
/// Not part of public API
static bool assertKey(dynamic key) {
if (key is int) {
if (key < 0 || key > 0xFFFFFFFF) {
throw HiveError('Integer keys need to be in the range 0 - 0xFFFFFFFF');
}
} else if (key is String) {
if (key.length > 0xFF || !key.isAscii) {
throw HiveError(
'String keys need to be ASCII Strings with a max length of 255');
}
} else {
throw HiveError('Keys need to be Strings or integers');
}
return true;
}
Is it not between -0xFFFFFFFF - 0xFFFFFFFF
The assertKey() function prevent using integer keys grether than 0xFFFFFFFF. Is that correct ? It has a reason?.
Thanks
Yes you are correct, and it has a reason beyond the creators of Hive's control.
Strings can have a lot more information in them because they are essentially arrays characters.
Hi, Why exists a max limit to integer key value of 0xFFFFFFFF ?
I have greaters keys values that I can´t use. With string keys is allowed lenght until 255 characters
thanks