NQE Types
NQE type literals are used in NQE queries in several places:
- Missing Values
- User-Defined Variables and Functions
- Parameterized Queries
- extractJson built-in function
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 as42(see Numbers).- In the future, the name
Numberwill be deprecated in favour ofInteger.
- In the future, the name
Float: a decimal number such as4.2(see Numbers).Bool: a boolean such astrue(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 typeT. The typeTcan 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 typeT. For example, a regular expression of typeRegex<{Location: String, ID: Number}>can be used to extract a value of typeNumberwhen matched successfully against a string; one such regular expression isre`(?<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 typeT. For example, a pattern of typePattern<Number>will return a value of typeNumberwhen 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 typeT. For example, a pattern of typePatternBlocks<Number>will return a value of typeNumberwhen matched successfully against a string; one such pattern isA function with a parameter of this type is```
{number}
```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 includeAdminStatusandDevice(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 typeDeviceand 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 anamefield and an optionalmtufield.