Assuming I have two ipv6 addresses that represent a range, what is the best way to store the data so I can use a query to see if another ipv6 address is within that range? Would converting to a 128 bit number work? Are numbers that large supported? Is there a better way?
Thanks.
vsr1
April 23, 2019, 10:17pm
2
N1QL support number which is float64 2**64 ( high end numbers can loose precision due to floating point rounding).
You can can convert 128 bit into string of fixed length (leading/trailing zeros). Then You can do range comparison on strings.
Example: "000000000000000000000000000000000011000" < "000000000000000000000000000000000110000"
If ipv6 address ranges are left to right you can convert individual parts has leading/trailing zeros with fixed length.
Check this how timestamp is stored in ISO-8601 format can easily string comparable (https://fits.gsfc.nasa.gov/iso-time.html ). Use similar technique
Thanks,
The method should would with HEX numbers represented as strings correct?
vsr1
April 25, 2019, 6:56pm
4
I know representation of decimal numbers will work. not sure about HEX numbers you need to verify