IPV6_CIDR_TO_RANGE

SinceVersion dev

IPV6_CIDR_TO_RANGE

description

Syntax

STRUCT<IPV6, IPV6> IPV6_CIDR_TO_RANGE(IPV6 ip_v6, INT16 cidr)

Receive an IPv6 and an Int16 value containing CIDR. Returns a struct that contains two IPv6 fields representing the lower range (min) and higher range (max) of the subnet, respectively.

notice

If the input parameter is NULL, return NULL, indicating invalid input

example

  1. mysql> SELECT ipv6_cidr_to_range(ipv6_string_to_num('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32);
  2. +---------------------------------------------------------------------------------------+
  3. | ipv6_cidr_to_range(ipv6_string_to_num('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32) |
  4. +---------------------------------------------------------------------------------------+
  5. | {"min": "2001:db8::", "max": "2001:db8:ffff:ffff:ffff:ffff:ffff:ffff"} |
  6. +---------------------------------------------------------------------------------------+
  7. mysql> SELECT ipv6_cidr_to_range(to_ipv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32);
  8. +----------------------------------------------------------------------------+
  9. | ipv6_cidr_to_range(to_ipv6('2001:0db8:0000:85a3:0000:0000:ac1f:8001'), 32) |
  10. +----------------------------------------------------------------------------+
  11. | {"min": "2001:db8::", "max": "2001:db8:ffff:ffff:ffff:ffff:ffff:ffff"} |
  12. +----------------------------------------------------------------------------+
  13. mysql> SELECT ipv6_cidr_to_range(NULL, NULL);
  14. +--------------------------------+
  15. | ipv6_cidr_to_range(NULL, NULL) |
  16. +--------------------------------+
  17. | NULL |
  18. +--------------------------------+

keywords

IPV6_CIDR_TO_RANGE, IP