Skip to main content

NQE Types

NQE type literals are used in NQE queries in several places:

NQE types also appear in diagnostic messages if there is a problem with a query definition.

Here is a list of all the types available in NQE and the syntax for each of these types:

  • String: a string such as "foo" (see Strings).
  • Number: a whole number such as 42 (see Numbers).
    • In the future, the name Number will be deprecated in favour of Integer.
  • Float: a decimal number such as 4.2 (see Numbers).
  • Bool: a boolean such as true (see Booleans).
  • IpAddress: an IP address such as 127.0.0.1 (see IP Addresses).
  • IpSubnet: an IP subnet such as 127.0.0.1/4 (see IP Subnets).
  • MacAddress: a MAC address such as 12:34:56:AB:CD:EF (see MAC Addresses).
  • Date: a date such as October 29, 1929 (see Time).
  • Timestamp: a date and time in UTC such as midnight UTC on January 1, 2000 (see Time).
  • Duration: an interval of time such as 23 hours, 56 minutes, and 4 seconds (see Time).
  • List<T>: a list whose elements are of type T. The type T can be replaced with any NQE type; for example, List<IpAddress> is the type of a list of IP addresses (see Lists).
  • Regex<T>: a regular expression whose match result is of type T. For example, a regular expression of type Regex<{Location: String, ID: Number}> can be used to extract a value of type Number when matched successfully against a string; one such regular expression is re`(?<Location>\w{1,4})(?<ID:Number>\d{3})`. For more information see the Regular Expression Guide on Data Extraction.
  • Pattern<T>: a pattern whose match result is of type T. For example, a pattern of type Pattern<Number> will return a value of type Number when matched successfully against a string; one such pattern is `{number}`. For more information see Extracting Data from Configurations via Pattern Matching.
  • PatternBlocks<T>: a block of patterns whose match result is of type T. For example, a pattern of type PatternBlocks<Number> will return a value of type Number when matched successfully against a string; one such pattern is
    ```
    {number}
    ```
    A function with a parameter of this type is blockMatches.
  • TypeName: any type can be referred to by its name, which is any word in leading uppercase that contains only numbers and letters. Some examples include AdminStatus and Device (see the Data Model tab).
  • { field1: type1, field2: type2, ..., fieldN: typeN }: a record type (see Records), denoted as a list of fields and their associated types. For example, { device: Device, ipAddrs: List<IpAddress> } is the type of a record containing a "device" field of type Device and an "ipAddrs" field that is a list of IP addresses. To declare an optional field, follow the field name with a question mark; for example {name: String, mtu?: Number} is a record with a name field and an optional mtu field.