Why is numUpdatedRows a BigInt?
Hi. I'd just like to ask as to why the number of updated rows in Kysely is a BigInt, as for all other ORMs that I've seen, it's just a normal number. Was there any reason for this decision?
Solution:Jump to solution
In reality it can't. That SSD would use up all the atoms in the universe ๐
It's more for consistency. The inserted row's ID in the
InsertObject
needs to be a bigint. Therefore all the others are too....15 Replies
Hey ๐๐ป
Number of rows in a single table can exceed JavaScript integer safe number range.
Solution
In reality it can't. That SSD would use up all the atoms in the universe ๐
It's more for consistency. The inserted row's ID in the
InsertObject
needs to be a bigint. Therefore all the others are too.so would it make sense to change both of them to number instead?
i mean the updated rows would make more sense being an int
No, the ID can exceed the safe integer range
hmm i see the dillema
Easily. The ID is not always automatically generated. It might be random 64bit integer for example. Or you could start the generator from some huge number. Or you could reset it to a huge number.
You can just do this though
Number(result.numUpdatedRows)
fair enough
i was just trying to check if it was more than zero which should be true, found another bug with TS though lol
anyways, thanks ๐
Well I'm pretty sure you didn't find a bug in typescript.
it was found before
GitHub
'bigint' is not comparable to 'number' with loose equality ยท Issue ...
TypeScript Version: 3.3.3 Search Terms: bigin == number not comparable loose equality Code 1n == 1 error: This condition will always return 'false' since the types 'bigint' and '...
that's what i meant, not amazing wording from my side
You could compare it to a zero bigint literal
result.numUpdateRows !== 0n
?yeah thats what i did in the end
In reality it can't. That SSD would use up all the atoms in the universe ๐Ever heard about middle-out compression? ๐คฃ
Damn that was a great show! I hated the ending though