Represents an inet column for Data API tables.

You may use the inet function as a shorthand for creating a new DataAPIInet.

See the official DataStax documentation for more information.

Implements

Constructors

  • Creates a new DataAPIInet instance from a vector-like value.

    If you pass a version, the value will be validated as an IPv4 or IPv6 address; otherwise, it'll be validated as either, and the version will be inferred from the value.

    You can set validate to false to bypass any validation if you're confident the value is a valid inet address.

    Parameters

    • address: string | DataAPIInet

      The address to create the DataAPIInet from

    • Optional version: null | 4 | 6

      The IP version to validate the address as

    • validate: boolean = true

      Whether to actually validate the address

    Returns DataAPIInet

    Throws

    TypeError If the address is not a valid IPv4 or IPv6 address

Properties

_raw: string
_version: 4 | 6 | nullish

Accessors

  • get version(): 4 | 6
  • Returns the IP version of the inet address.

    Returns 4 | 6

    The IP version of the inet address

Methods

  • Errorful implementation of $SerializeForCollection for TableCodec

    Throws a human-readable error message warning that this datatype may not be used with collections without writing a custom ser/des codec.

    Returns void

  • Returns the string representation of the inet address.

    Returns string

    The string representation of the inet address

  • Checks if a string is a valid IPv4 address.

    NOTE: Will cover all common cases of IP addresses, but may reject otherwise valid addresses in more esoteric, yet still technically legal, forms.

    However, this will never return true on an IP which is actually invalid.

    Parameters

    • raw: string

    Returns boolean

  • Checks if a string is a valid IPv6 address.

    NOTE: Will cover all common cases of IP addresses, but may reject otherwise valid addresses in more esoteric, yet still technically legal, forms.

    However, this will never return true on an IP which is actually invalid.

    Parameters

    • raw: string

    Returns boolean